CheckAndAuditOperation(Operation: Integer; Comment: String; State: MetabaseObjectAuditOperationState): Decimal;
Operation. Mask of the checked/recorded operations, the availability of permissions, to which it is necessary to check for the current user. To create a mask value, one should use values of the MetabaseObjectPredefinedRights enumeration. This enumeration contains basic and additional operations, for which permissions can be granted and access auditing 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:
CalculatedCubeSpecificRights are specific operations available for calculated cubes.
CubeLoaderSpecificRights are specific operations available for loading data in a cube.
CubeSpecificRights are specific operations available for different types of cubes.
CustomObjectSpecificRights are specific operations available for objects of custom classes.
DataBaseSpecificRights are specific operations available for the Database repository object.
DictionarySpecificRights are specific operations available for the repository objects - MDM Dictionary and Composite MDM dictionary.
MDCalcSpecificRights are specific operations available for the Multidimensional Calculation on Database Server repository object.
ProblemSpecificRights are specific operations available for the Modeling Problem modeling container object.
ProcedureSpecificRights are specific operations available for the Procedure repository object.
TableSpecificRights are specific operations available for the following repository objects - Table, View, Log, External Table.
ValidationSpecificRights are specific operations available for the Validation Rule and Validation Group repository object.
Comment. The comment that is entered in the access protocol.
State. Operation auditing option.
The CheckAndAuditOperation method checks access permissions of the current user for the specified operations and tracks the check result in accordance with the selected auditing option.
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) was selected, the exception is thrown. Depending on the present settings of schema auditing 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.
If it is necessary to check access permissions for custom class operation, use the IMetabaseCustomObject.CheckAndAuditOperation method.
Executing the example requires that the repository contains a regular report with the REPORT identifier.
Add links to the Metabase, Ui system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("REPORT");
Try
MObj.CheckAndAuditOperation(
MetabaseObjectPredefinedRights.Write Or MetabaseObjectPredefinedRights.Print,
"Check user permissions" ,
MetabaseObjectAuditOperationState.ForceDeny);
Except On E: Exception Do
Debug.WriteLine(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). A record with failed result is added to the access protocol if auditing for the checked object type was enabled in the schema auditing settings.
See also: