IMetabaseObjectDescriptor.CheckAndAudit

Syntax

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

Parameters

Operation. The mask that determines operations, the availability of permissions to which is necessary to check for the current user. To create a mask value, one should use values of the MetabaseObjectPredefinedRights enumeration type. This enumeration contains basic and additional operations, on which permissions can be granted and access audit can be executed. The specific operations are available for specific object classes. To use specific operations depending on the object class, one can use values of the following enumerations in a mask:

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 permissions even to one of the checked operations, the record with failed result will be added to the access protocol and the exception will be thrown.

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

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

Example

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

Add a link to the Metabase system assembly.

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

After executing the example it is checked if the current user has permissions to delete and change access permissions of the specified object. The appropriate record is added to the access protocol.

See also:

IMetabaseObjectDescriptor