SubjectGranted(Subject: ISecuritySubject): Boolean;
Subject. Security subject.
The SubjectGranted method returns whether the security subject sent by the Subject parameter has this privilege.
The method returns True if the security subject has this privilege, otherwise it returns False.
To execute the example, make sure that security manager contains the USER user.
Add a link to the Metabase system assembly.
Sub UserProc;
Var
MB: IMetabase;
MS: IMetabaseSecurity;
MP: IMetabasePolicy;
Priv: IPrivilege;
Subject: ISecuritySubject;
Begin
MB := MetabaseClass.Active;
MS := MB.Security;
MP := MS.Policy;
Priv := MP.Privilege("READ");
Subject := MB.Security.ResolveName("USER");
If Priv.SubjectGranted(Subject) Then
Debug.WriteLine("User has read and open object privilege");
Else
Debug.WriteLine("User does not have read and open object privilege");
End If;
End Sub UserProc;
After executing the example the development environment console displays an information message whether the USER user has a privilege to read and open objects.
See also: