IMetabaseObjectDescriptor.CheckAndAudit

Syntax

CheckAndAudit(Operation: Integer; Comment: String): Decimal;

Parameters

Operation. 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 type 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:

Comment. The comment that is entered in the access protocol.

Description

The CheckAndAudit method checks the access permissions of the current user for the specified operations and writes the record into the access protocol with the specified comment.

Comments

If the current user does not have rights even to one of checked operations, the record with failed result will be entered in the access protocol and the exceptional condition will be generated.

The method returns unique key of the record which is written in the access protocol.

If it is necessary to check access permissions for custom class operation, use the IMetabaseCustomObject.CheckAndAudit method.

Example

Executing the example requires that the repository contains an object with the Obj_1111 identifier.

Add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObjectDescriptor;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemById(
"Obj_1111");
    MObj.CheckAndAudit(
    MetabaseObjectPredefinedRights.Delete 
Or
    MetabaseObjectPredefinedRights.Access,
    
"Check whether the current user has permissions for the Removal and Change Permissions operations" );
End Sub UserProc;

After executing the example the availability of the rights of the current user to remove and change access permissions of the Obj_1111 object is checked. The appropriate record is added to the access protocol.

See also:

IMetabaseObjectDescriptor