Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: adepreter on April 21, 2016, 06:48:32 pm

Title: Security groups that the current user belongs to (scripting)
Post by: adepreter on April 21, 2016, 06:48:32 pm
Is there a way to create, by script, a dictionary object that contains the Security groups that the current user belongs to?

Cheers,

Alain
Title: Re: Security groups that the current user belongs to (scripting)
Post by: qwerty on April 21, 2016, 07:00:32 pm
Sort of. You can query the tables t_secuser, t_secgroup, t_secusergroup and t_secgrouppermission to get the information you need.

q.
Title: Re: Security groups that the current user belongs to (scripting)
Post by: Geert Bellekens on April 21, 2016, 07:01:15 pm
There's not really an API object for security users or groups, but you can certainly get the info from the database using Repository.SQLQuery

You can use Repository.GetCurrentLoginUser (boolean GetGuid) to get the current user and use that to select the groups

Code: [Select]
select g.GroupName from t_secusergroup ug
inner join t_secgroup g on g.GroupID = ug.GroupID
where ug.UserID = '<userGUID>'

Geert
Title: Re: Security groups that the current user belongs to (scripting)
Post by: adepreter on April 21, 2016, 10:41:46 pm
Thank you. Very good idea.