IMetabaseObjectDescriptor.HasAccess

Syntax

HasAccess(AccessMask: Integer): Boolean;

HasAccess(AccessMask: integer): boolean;

Parameters

AccessMask.Mask that determines operations, the availability of rights to which it is necessary to check for the current user. To create a mask value, it is necessary to use the MetabaseObjectPredefinedRights enumeration values. 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 whether the current user has permissions to execute specified operations with object.

Comments

Operations the availability of permissions to which should be checked are passed by the AccessMask parameter. If the current 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 ObjTest identifier.

Add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObjectDescriptor;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemById(
"ObjTest");
    Debug.WriteLine(MObj.HasAccess(
    MetabaseObjectPredefinedRights.ExportData 
Or
    MetabaseObjectPredefinedRights.ImportData));
End Sub UserProc;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MObj: IMetabaseObjectDescriptor;
Begin
    MB := Params.Metabase;
    MObj := MB.ItemById[
"ObjTest"];
    System.Diagnostics.Debug.WriteLine(MObj.HasAccess(
    MetabaseObjectPredefinedRights.moprExportData 
As Integer Or
    MetabaseObjectPredefinedRights.moprImportData 
As Integer));
End Sub;
End Class;

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

See also:

IMetabaseObjectDescriptor