IMetabaseCustomObject.CheckAndAuditOperation

Syntax

CheckAndAuditOperationLabel(OperationKey: Integer; Comment: String; State: MetabaseObjectAuditOperationState): Decimal;

Parameters

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

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

State. Variant of operation auditing.

Description

The CheckAndAuditOperation method checks the access permissions of the current user for the specified operation of custom class and traces check result according to the selected audit variant.

Comments

If the current user does not have rights even to one of the checked operations or the variant of auditing that bans execution of the operation (ForceDeny, ForceDenyAndAudit) was chosen, the exception condition will be generated. Depending on the present settings of scheme auditing and on chosen variant of auditing of the checked operation (State), a record with failed result can be added to access protocol.

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.CheckAndAuditOperation 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");
    Try
        Key := CustObj.CheckAndAuditOperation(Operation.Key,
            "Access check for operation execution: " + Operation.Name,
            MetabaseObjectAuditOperationState.ForceDeny);
    Except
        On E: Exception Do
        WinApplication.InformationBox(E.message);
    End Try;
End Sub UserProc;

After executing this example the exception condition is generated (the user does not have enough rights to perform operation of custom class). A record with failed result is added to the access protocol, if the auditing for the type of checked object was activated in the settings of scheme auditing.

See also:

IMetabaseCustomObject