SubjectGranted(Subject: ISecuritySubject): Boolean;
Subject is a security subject.
The SubjectGranted method returns whether the security subject that is passed by the Subject parameter has this privilege.
The method returns True if the security subject has this privilege, if not, it returns False.
Executing the example requires the user with the TESTUSER name that was created in the security manager.
Sub Main;
Var
MB: IMetabase;
MS: IMetabaseSecurity;
MP: IMetabasePolicy;
Priv: IPrivilege;
Subject: ISecuritySubject;
Begin
MB := MetabaseClass.Active;
MS := MB.Security;
MP := MS.Policy;
Priv := MP.Privilege("Reading");
Subject := MB.Security.ResolveName("TESTUSER");
If Priv.SubjectGranted(Subject) Then
Debug.WriteLine("User has a privilege for reading and opening the objects");
Else
Debug.WriteLine("User has not a privilege for reading and opening the objects");
End If;
End Sub Main;
After executing the example the information message that the TESTUSER has a privilege for reading and opening the objects is displayed in the development environment console.
See also: