ISecuritySubject.HasAccessToRepository

Fore Syntax

HasAccessToRepository: Boolean;

Fore.NET Syntax

HasAccessToRepository: System.Boolean;

Description

The HasAccessToRepository method checks whether the security subject has effective permissions for the repository objects.

Comments

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.

Fore Example

To execute the example, add a link to the Metabase system assembly. In the security manager the list of subjects must contain the "subject" user or group.

Sub Main;
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    SecSub: ISecuritySubject;
Begin
    MB := MetabaseClass.Active;
    MS := MB.Security;
    SecSub:= MS.ResolveName("subject");
    If SecSub.HasAccessToRepository Then
        Debug.WriteLine("The subject has access permissions");
    Else 
        Debug.WriteLine("The subject does not have access permissions"); 
    End If;
End Sub Main;

After executing the example the console window displays the message about subject's permissions.

Fore.NET Example

The "subject" user should be in the security manager in the list of users. The specified procedure is an entry point for the .NET assembly.

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    SecSub: ISecuritySubject;
Begin
    MB := Params.Metabase;
    MS := MB.Security;
    SecSub:= MS.ResolveName("subject");
    If SecSub.HasAccessToRepository() Then
        System.Diagnostics.Debug.WriteLine("User has the access rights");
    Else 
        System.Diagnostics.Debug.WriteLine("User doesn't have the access rights");  
    End If;
End Sub;

After executing the example the console window displays the message about subject's permissions.

See also:

ISecuritySubject