IPrivilege.Holder

Syntax

Holder(Index: Integer): ISecuritySubject;

Holder[System.Int32]: Prognoz.Platform.Interop.Metabase.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

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;

Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    MP: IMetabasePolicy;
    Priv: IPrivilege;
    Subject: ISecuritySubject;
    i: Integer;
Begin
    MB := Params.Metabase;
    MS := MB.Security;
    MP := MS.Policy;
    Priv := MP.Privilege[
"LOGIN"];
    System.Diagnostics.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.sstGroup Then
            System.Diagnostics.Debug.WriteLine(
"Group: " + Subject.Name);
        
Else
            System.Diagnostics.Debug.WriteLine(
"User: " + Subject.Name);
        
End If;
    
End For;
End Sub;

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

See also:

IPrivilege