IMetabaseCustomObject.CheckAndAudit

Syntax

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

Parameters

OperationKey. Key of the custom class operations which execution possibility has to be checked.

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 custom class operation and writes the record into the access protocol with the specified comment.

Comments

If the current user has no rights for the specified operation, a record with unsuccessful result is written into access protocol and an exception error is generated.

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

The method is used to check access permissions on custom class operations described by the IMetabaseCustomClassOperation interface. To check access permissions for main and additional operations, use the IMetabaseObjectDescriptor.CheckAndAudit method.

Example

Executing the example requires that the repository contains a custom class object with the OBJ_CUSTOM identifier. The operation with the CLS1OP1 identifier should be created for the custom class.

Sub UserProc;
Var
    MB: IMetabase;
    CustObj: IMetabaseCustomObject;
    Operation: IMetabaseCustomClassOperation;
    Key: Decimal;
Begin
    MB := MetabaseClass.Active;
    CustObj := MB.ItemById("OBJ_CUSTOM").Bind As IMetabaseCustomObject;
    Operation := CustObj.CustomClass.Operations.FindById("CLS1OP1");
    Key := CustObj.CheckAndAudit(
            Operation.Key,
            "Access check for operation execution: quot;nbsp;+nbsp;Operation.Name,
End Sub UserProc;

After executing the example, the possibility of executing the first custom class operation is checked for the specified object. The respective record is added to the access protocol.

See also:

IMetabaseCustomObject