CheckAndAuditOperationLabel(OperationKey: Integer; Comment: String; State: MetabaseObjectAuditOperationState): Decimal;
OperationKey. Key of the custom class operation, which execution possibility should be checked.
Comment. The comment that is entered in the access protocol.
State. Operation auditing option.
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.
If the current user does not have permissions even to one of the checked operations or the auditing option that denies execution of the operation (ForceDeny, ForceDenyAndAudit) is selected, the exception is thrown. Depending on the present schema auditing settings and the selected auditing option of the checked operation (State), a record with failed result can be added to the access protocol.
The method returns unique key of the record, which is written to the access protocol.
The method is used to check access permissions for custom class operations described by the IMetabaseCustomClassOperation interface. To check access permissions for basic and additional operations, use the IMetabaseObjectDescriptor.CheckAndAuditOperation method.
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,
"Check operation execution permissions: " + Operation.Name,
MetabaseObjectAuditOperationState.ForceDeny);
Except
On E: Exception Do
WinApplication.InformationBox(E.message);
End Try;
End Sub UserProc;
After executing the example the exception is thrown (the user does not have enough permissions to execute operation of custom class). A record with failed result is added to the access protocol if the auditing for the type of checked object is enabled in the schema auditing settings.
See also: