HasAccessToRepository: Boolean;
HasAccessToRepository: System.Boolean;
The HasAccessToRepository method checks whether the security subject has effective permissions for the repository objects.
The method returns True if the subject has some access permissions to any object of the repository, otherwise it returns False. The method checks only permissions and ignores prohibitions, that is for the subject which has only prohibitions the method returns False.
Verification of effective permissions for the repository objects can take long time.
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;
SecSub: ISecuritySubject;
Begin
MB := MetabaseClass.Active;
MS := MB.Security;
SecSub:= MS.ResolveName("USER");
If SecSub.HasAccessToRepository Then
Debug.WriteLine("User has access permissions");
Else
Debug.WriteLine("User does not have access permissions");
End If;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Metabase;
…
Public Shared Sub Main(Params : StartParams);
Var
MB: IMetabase;
MS: IMetabaseSecurity;
SecSub: ISecuritySubject;
Begin
MB := Params.Metabase;
MS := MB.Security;
SecSub:= MS.ResolveName("USER");
If SecSub.HasAccessToRepository() Then
System.Diagnostics.Debug.WriteLine("User has access permissions");
Else
System.Diagnostics.Debug.WriteLine("User does not have access permissions");
End If;
End Sub;
After executing the example the console displays a message about user effective permissions.
See also: