ShowHoursPolicy Command

Purpose

Opens a standard dialog box that is used to distribute system access time for the user.

Parameters of Use

Command parameters are passed in the Data property. Executing the command requires to specify the following value in this property:

Value type Description
IMetabaseUser,
ISecuritySubject
User for whom it is necessary to set up access time permissions.

Application Features

None

Example

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

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

Sub UserProc;
Var
    Mb: IMetabase;
    MbSec: IMetabaseSecurity;

    User: ISecuritySubject;
    Target: IUiCommandTarget;
    Context: IUiCommandExecutionContext;
    Lic: Object;
Begin
    MB := MetabaseClass.Active;
    
// Get license to work with security manager
    Lic := Mb.RequestLicense(UiLicenseFeatureType.Adm);
    MbSec := MB.Security;

    User := MbSec.ResolveName("USER");
    Target := WinApplication.Instance.GetPluginTarget(
"Adm");
    Context := Target.CreateExecutionContext;
    Context.Data := User;
    Target.Execute(
"ShowHoursPolicy", Context);
    
// Save changes
    MbSec.Apply;
    
// Check in license
    Lic := Null;
End Sub UserProc;

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

Public Shared Sub Main(Params: StartParams);
Var
    Mb: IMetabase;
    MbSec: IMetabaseSecurity;
    User: ISecuritySubject;
    Target: IUiCommandTarget;
    Context: IUiCommandExecutionContext;
    WinApp: WinApplicationClassClass;
    Lic: Object;
Begin
    MB := Params.Metabase;
    
// Get license to work with security manager
    Lic := Mb.RequestLicense(UiLicenseFeatureType.lftAdm);
    MbSec := MB.Security;
    User := MbSec.ResolveName(
"USER");
    WinApp := 
New WinApplicationClassClass();
    Target := WinApp.Instance[
Null].GetPluginTarget("Adm");
    Context := Target.CreateExecutionContext();
    Context.Data := User;
    Target.Execute(
"ShowHoursPolicy", Context, Null);
    
// Save changes
    MbSec.Apply();
    
// Check in license
    Lic := Null;
End Sub;

After executing the example a dialog box opens to control access by time for the USER user.

See also:

IUiCommandTarget.Execute