IPrivilege.Revoke

Syntax

Revoke(Subject: ISecuritySubject);

Revoke(Prognoz.Platform.Interop.Metabase.ISecuritySubject);

Parameters

Subject. Security subject.

Description

The Revoke method revokes the privilege from the security subject that is passed by the Subject parameter.

Example

To execute the example, make sure that security manager contains the USER user.

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

Sub UserProc;
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    MP: IMetabasePolicy;
    Priv: IPrivilege;
    Subject: ISecuritySubject;
    Lic: Object;
Begin
    MB := MetabaseClass.Active;
    
// Get license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
    MS := MB.Security;
    MP := MS.Policy;
    
// Delete privilege holder
    Priv := MP.Privilege("READ");
    Subject := MS.ResolveName(
"USER");
    Priv.Revoke(Subject);
    
// 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;
    MP: IMetabasePolicy;
    Priv: IPrivilege;
    Subject: ISecuritySubject;
    Lic: Object;
Begin
    MB := Params.Metabase;
    
// Get license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
    MS := MB.Security;
    MP := MS.Policy;
    
// Delete privilege holder
    Priv := MP.Privilege["READ"];
    Subject := MS.ResolveName(
"USER");
    Priv.Revoke(Subject);
    
// Save changes
    MS.Apply();
    
// Check in license
    Lic := Null;
End Sub;

After executing the example the privilege for reading and opening the repository objects is revoked from the USER user.

See also:

IPrivilege