IMetabaseUpdateMandatoryAccess.Category

Syntax

Category: IMetabaseUpdateSecurityCategory;

Description

The Category property returns the category by index.

Example

To execute the example add links to the Metabase and Stat system assemblies. The D:\Update.pefx update file is required.

Sub main;
Var
    Mb: IMetabase;
    Upd: IMetabaseUpdate;
Begin   
    MB := MetabaseClass.Active;
    Upd := Mb.CreateUpdate;
    Upd.LoadFromFileNF("D:\Update.pefx");
    Upd.Prepare;
    updateMandatory(Upd);
    Upd.SaveAvailable("D:\Update.pefx");
End Sub main;

Sub updateMandatory (update: IMetabaseUpdate);
    Var
        muma: IMetabaseUpdateMandatoryAccess;
        musc: IMetabaseUpdateSecurityCategory;
        musl: IMetabaseUpdateSecurityLevel;
        i, j: integer;
        mma: IMetabaseMandatoryAccess;
        Mb: IMetabase;      
    Begin
        Mb := MetabaseClass.Active;     
        muma := update.MandatoryAccess;
        mma := Mb.Security.Policy.MandatoryAccess;
        debug.WriteLine("Indicates whether the mandatory access control is enabled in customer database:  "+Mb.Security.Policy.MandatoryAccessControl.ToString);
        For i := 0 To muma.CategoryCount - 1 Do
            musc := muma.Category(i);
            If musc.Exists.ToString <> "True" Then
                debug.WriteLine("New category is required:  "+musc.Name);
            Else
            debug.WriteLine("Name of the category in the customer database:  "+musc.Name);
            debug.WriteLine("Key of the category in the customer database:  "+musc.Key.ToString);
            debug.WriteLine("Availability of the category in the customer database:  "+musc.IsValid.ToString);
            For j := 0 To musc.LevelCount - 1 Do
                musl := musc.Level(j);
                If musl.Exists.ToString <> "True" Then
                    debug.WriteLine("New level of the category is required:  "+musl.Name+" ("+musl.Category.Name+")");
                Else
                debug.WriteLine("Name of the security level (category) in the customer database:  "+musc.FindLevelByLabel(musl.Index).Name+" ("+musl.Category.Name+")");
                debug.WriteLine("Existence of the security level in the customer database:  "+musc.Level(j).Exists.ToString+ " Label of the security level:  "+musl.CriticalityLabel.ToString);
                debug.WriteLine("Description of the security level in the customer database:  "+musl.Description);
                debug.WriteLine("Availability of the security level in the customer database:  "+musl.IsValid.ToString);
                End If;
            End For;
            End If;
        End For;
End Sub updateMandatory;

After executing the example the console window displays information about using the mandatory control in the database, on which the unit is to be started, about the existence of corresponding categories and levels from the update in the database, on which the unit is to be started and the information about the corresponding categories and levels.

See also:

IMetabaseUpdateMandatoryAccess