IPrivilege.Holder

Syntax

Holder(Index: Integer): ISecuritySubject;

Parameters

Index. Security subject index.

Description

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

Comments

If the security subject is the user with the lazy loading of 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

To execute the example, add a link to the Metabase system assembly.

Sub UserProc;
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(
"LOGIN");
    Debug.WriteLine(
"The following security subjects have platform login privilege:");
    
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 UserProc;

After executing the example the development environment console displays the list of security subjects having the platform login privilege.

See also:

IPrivilege