IMetabaseMandatoryAccess.AddCategory

Syntax

AddCategory(Name: String): ISecurityCategory;

AddCategory(System.String): Prognoz.Platform.Interop.Metabase.ISecurityCategory;

Parameters

Name. New category name.

Description

The AddCategory method creates security category.

Example

To execute the example, add links to the Metabase, ForeSystem (for the Fore.NET example) system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    MU: IMetabasePolicy;
    MAccess: IMetabaseMandatoryAccess;
    Cat: ISecurityCategory;
    Lvl: ISecurityLevel;
    Lic: Object;
Begin
    MB := MetabaseClass.Active;
    
// Check out license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
    MS := MB.Security;
    MU := MS.Policy;
    
// Get mandatory access control settings
    MAccess := MU.MandatoryAccess;
    
// Add a new category and security levels
    Cat := MAccess.AddCategory("Category 1");
    Lvl := Cat.AddLevel(
0"Level 0");
    Lvl.Marking := 
True;
    Lvl := Cat.AddLevel(
1"Level 1");
    Lvl.ExportAllowed := 
False;
    Lvl := Cat.AddLevel(
2"Level 2");
    Lvl.ExportAllowed := 
False;
    Lvl.PrintAllowed := 
False;
    
// Save changes
    MS.Apply;
    
// Check in license
    Lic := Null;
End Sub UserProc;

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.ForeSystem;

Public Shared Sub Main(Params : StartParams);
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    MU: IMetabasePolicy;
    MAccess: IMetabaseMandatoryAccess;
    Cat: ISecurityCategory;
    Lvl: ISecurityLevel;
    Lic: Object;
Begin
    MB := Params.Metabase;
    
// Check out license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
    MS := MB.Security;
    MU := MS.Policy;
    
// Get mandatory access control settings
    MAccess := MU.MandatoryAccess;
    
// Add a new category and security levels
    Cat := MAccess.AddCategory("Category 1");
    Lvl := Cat.AddLevel(
0"Level 0");
    Lvl.Marking := 
True;
    Lvl := Cat.AddLevel(
1"Level 1");
    Lvl.ExportAllowed := 
False;
    Lvl := Cat.AddLevel(
2"Level 2");
    Lvl.ExportAllowed := 
False;
    Lvl.PrintAllowed := 
False;
    
// Save changes
    MS.Apply();
    
// Check in license
    Lic := Null;
End Sub;

After executing this example a new category is created in mandatory access of a security manager. In this category three security levels are created. For each level different access parameters of export and print and also labels during export and print are assigned.

See also:

IMetabaseMandatoryAccess