IMetabaseObjectDescriptor.CheckAndAuditOperationLabel

Syntax

CheckAndAuditOperationLabel(

Operation: Integer;

Comment: String;

State: MetabaseObjectAuditOperationState;

Var Label: ISecurityDocumentLabel): Decimal;

Parameters

Operation. Mask of the checked/recorded operations, the availability of rights 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 on which permissions can be given and access audit can be led. 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.

State. Variant of operation auditing.

Label. The variable, to which the parameters of security label will be placed.

Description

The CheckAndAuditOperationLabel method checks access permissions of the current user to execute the specified operations and writes a protocol of check result according to selected audit option and calculates parameters of security label used on printing and exporting repository objects.

Comments

Security label is calculated if the mandatory access to objects is active.

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.

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 a regular report with the REPORT identifier.

Add links to the Metabase, Ui system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    MObj: IMetabaseObjectDescriptor;
    Label: ISecurityDocumentLabel;
Begin
    Mb := MetabaseClass.Active;
    MObj := Mb.ItemById("REPORT");
    Try
        MObj.CheckAndAuditOperationLabel(
            MetabaseObjectPredefinedRights.Write Or MetabaseObjectPredefinedRights.Print,
            "Check user permissions" ,
            MetabaseObjectAuditOperationState.ForceAudit,
            Label);
    Except On E: Exception Do
        Debug.WriteLine(E.Message);
    End Try;
    If Label.IsON Then
        Debug.WriteLine(Label.Label);
        Debug.WriteLine(Label.LabelDescription);
        Debug.WriteLine(Label.TreatSectionAsDocument);
        Debug.WriteLine(Label.User.Name);
    End If;
End Sub UserProc;

After executing the example it is checked if the current user has permissions to change and print the specified report. A record about the ability to execute the operation is added to the access protocol. If the mandatory access control is enabled in the repository and the access level, for which the marking of objects is enabled during export and printing, is specified for the object, the Label variable contains parameters of the security label that is used for marking. These parameters are displayed in the development environment console.

See also:

IMetabaseObjectDescriptor