IPrivilege.Holder

Syntax

Holder(Index: Integer): ISecuritySubject;

Parameters

Index. Security subject index.

Description

The Holder property returns parameters of the security subject (the user or group of users) that has this privilege.

Comments

If the security subject is the user with the deferred loading of the description, the property returns only the basic description (Name, security subject type and security descriptor). To get all parameters of the user, use the IMetabaseSecurity.ResolveName, IMetabaseSecurity.ResolveSid methods or search via IMetabaseSecurity.NewSubjectsSearch.

Example

Sub Main;

Var

MB: IMetabase;

MS: IMetabaseSecurity;

MP: IMetabasePolicy;

Priv: IPrivilege;

Subject: ISecuritySubject;

i: Integer;

Begin

MB := MetabaseClass.Active;

MS := MB.Security;

MP := MS.Policy;

Priv := MP.Privilege("Entry");

Debug.WriteLine("The following security subjects have the privilege of logging in the platform:");

For i := 0 To Priv.HolderCount - 1 Do

Subject := Priv.Holder(i);

If Subject.Type = SecuritySubjectType.Group Then

Debug.WriteLine("Group: " + Subject.Name);

Else

Debug.WriteLine("User: " + Subject.Name);

End If;

End For;

End Sub Main;

After executing the example the development environment console will display the list of security subjects having the privilege of logging in the platform.

See also:

IPrivilege