IMetabaseUser.HasAccess

Syntax

HasAccess(SecurityDescriptor: ISecurityDescriptor; DesiredAccess: Integer): Boolean;

Parameters

SecurityDescriptor. The parameters of the repository object security.

DesiredAccess. Mask that determines operations, the availability of rights to which it is necessary to check for the user. It is necessary to use values of the enumeration type MetabaseObjectPredefinedRights to form mask value. This enumeration contains basic and additional operations on which permissions can be given and access audit can be led. The specific operations are available for defined classes of objects. To use specific operations depending on the object class in a mask there is a possibility to use values of the following enumerations:

Description

The HasAccess method checks the availability of the user permissions for certain object manipulations.

Comments

Operations, the availability of rights to which should be checked, are passed by the DesiredAccess parameter. If the user has rights to all specified operations, the method returns True, if not, the method returns False.

Example

Executing the example requires that the repository contains an object with the Obj_1 identifier. There is the TestUser user among the security subjects that were created in the security manager of the current repository.

Sub Main;
Var
    MB: IMetabase;
    User: IMetabaseUser;
    MObj: IMetabaseObjectDescriptor;
Begin
    MB := MetabaseClass.Active;
    User := MB.Security.ResolveName(
"TestUser"As IMetabaseUser;
    MObj := MB.ItemById(
"Obj_1");
    Debug.WriteLine(User.HasAccess(MObj.SecurityDescriptor,
        MetabaseObjectPredefinedRights.ExportData 
Or
        MetabaseObjectPredefinedRights.ImportData));
End Sub Main;

After executing this example an indicator of availability of rights of the TestUser user to export and import the data of the object with the Obj_1 identifier is displayed in the development environment console.

See also:

IMetabaseUser