MemberOf: IMetabaseGroups;
The MemberOf method returns a collection of the groups to which the given security subject is included.
To execute the example, make sure that the security manager contains users.
Add a link to the Metabase system assembly.
Sub UserProc;
Var
MB: IMetabase;
MSec: IMetabaseSecurity;
Users: IMetabaseUsers;
Groups: IMetabaseGroups;
Group: IMetabaseGroup;
Begin
MB := MetabaseClass.Active;
MSec := MB.Security;
Users := MSec.Users;
Groups := Users.Item(0).MemberOf;
For Each Group In Groups Do
Debug.WriteLine(Group.Name);
End For;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Metabase;
…
Public Shared Sub Main(Params : StartParams);
Var
MB: IMetabase;
MSec: IMetabaseSecurity;
Users: IMetabaseUsers;
Groups: IMetabaseGroups;
Group: IMetabaseGroup;
Begin
MB := Params.Metabase;
MSec := MB.Security;
Users := MSec.Users;
Groups := Users.Item[0].MemberOf();
For Each Group In Groups Do
System.Diagnostics.Debug.WriteLine(Group.Name);
End For;
End Sub;
After executing this example names of groups where the first user located and registered in a security manager are displayed in the development environment console.
See also: