SubjectGranted(Subject: ISecuritySubject): Boolean;
SubjectGranted(Prognoz.Platform.Interop.Metabase.ISecuritySubject): System.Boolean;
Subject. 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.
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;
Imports Prognoz.Platform.Interop.Metabase;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MS: IMetabaseSecurity;
MP: IMetabasePolicy;
Priv: IPrivilege;
Subject: ISecuritySubject;
Begin
MB := Params.Metabase;
MS := MB.Security;
MP := MS.Policy;
Priv := MP.Privilege["READ"];
Subject := MB.Security.ResolveName("USER");
If Priv.SubjectGranted(Subject) Then
System.Diagnostics.Debug.WriteLine("User has read and open objects privilege");
Else
System.Diagnostics.Debug.WriteLine("User does not have read and open objects privilege");
End If;
End Sub;
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: