ISecurityCategory.RemoveLevel

Syntax

RemoveLevel(Index: Integer): Boolean;

RemoveLevel(System.Int32): System.Boolean;

Parameters

Index. Security level index that must be deleted.

Description

The RemoveLevel method removes the security level and indicates whether the removal succeeded.

Example

To execute the example, make sure that mandatory access control contains at least one category and two levels.

Add links to the Metabase, ForeSystem (for the Fore.NET example) system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    MU: IMetabasePolicy;
    Cat: ISecurityCategory;
    MAccess: IMetabaseMandatoryAccess;
    Lic: Object;
Begin
    MB := MetabaseClass.Active;
    
// Get license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
    MS := MB.Security;
    MU := MS.Policy;
    MAccess := MU.MandatoryAccess;
    
// Delete the second level of the first category
    Cat := MAccess.Category(0); 
    Cat.RemoveLevel(1);
    
// 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;
    Cat: ISecurityCategory;
    MAccess: IMetabaseMandatoryAccess;
    Lic: Object;
Begin
    MB := Params.Metabase;
    
// Get license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
    MS := MB.Security;
    MU := MS.Policy;
    MAccess := MU.MandatoryAccess;
    
// Delete the second level of the first category
    Cat := MAccess.Category[0]; 
    Cat.RemoveLevel(1);
    
// Save changes
    MS.Apply();
    
// Check in license
    Lic := Null;
End Sub;

After executing the example, the second level will be deleted from the first security category of mandatory access control.

See also:

ISecurityCategory