IMetabasePolicy.PredefinedPrivilege

Syntax

PredefinedPrivilege(Predefined: MetabasePolicyPredefinedPrivilege): IPrivilege;

PredefinedPrivilege[Prognoz.Platform.Interop.Metabase.MetabasePolicyPredefinedPrivilege]: Prognoz.Platform.Interop.Metabase.IPrivilege;

Description

The PredefinedPrivilege property returns parameters of a specified privilege.

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;
    Policy: IMetabasePolicy;
    Priv: IPrivilege;
    User: ISecuritySubject;
    Lic: Object;
Begin
    MB := MetabaseClass.Active;
    
// Check out license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
    MS := MB.Security;
    Policy := MS.Policy;
    
// Add a privilege holder
    Priv := Policy.PredefinedPrivilege(MetabasePolicyPredefinedPrivilege.ReadAnyObject);
    User := MS.ResolveName(
"USER"As ISecuritySubject;
    Priv.Grant(User);
    
// 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;
    Policy: IMetabasePolicy;
    Priv: IPrivilege;
    User: ISecuritySubject;
    Lic: Object;
Begin
    MB := Params.Metabase;
    
// Check out license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
    MS := MB.Security;
    Policy := MS.Policy;
    
// Add a privilege holder
    Priv := Policy.PredefinedPrivilege[MetabasePolicyPredefinedPrivilege.metpolprepriReadAnyObject];
    User := MS.ResolveName(
"USER"As ISecuritySubject;
    Priv.Grant(User);
    
// Save changes
    MS.Apply();
    
// Check in license
    Lic := Null;
End Sub;

After executing the example, the specified USER user becomes holder of the Read and Open All Objects privilege.

See also:

IMetabasePolicy