ISecuritySubject.LogonHoursPolicy

Syntax

LogonHoursPolicy: ILogonHoursPolicy;

Description

The LogonHoursPolicy property returns settings of the security subject access to the Prognoz Platform by times.

Example

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

Add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    MP: IMetabasePolicy;
    User: ISecuritySubject;
    LogonHP: ILogonHoursPolicy;
    LH: ILogonHours;
    d1, d2, d3, d4: DateTime;
    i: Integer;
    Lic: Object;
Begin
    MB := MetabaseClass.Active;
    
// Get license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
    MS := MB.Security;
    MP := MS.Policy;
    
// Get user parameters
    User := MS.ResolveName("USER");
    
// Add schedule to enable access
    LogonHP := User.LogonHoursPolicy;
    d1 := DateTime.ComposeTimeOfDay(
0000);
    d2 := DateTime.ComposeTimeOfDay(
9000);
    d3 := DateTime.ComposeTimeOfDay(
18000);
    d4 := DateTime.ComposeTimeOfDay(
235900);
    
For i := 1 To 5 Do
        LH := LogonHP.WeekDayHours(i 
As CalendarDayOfWeek);
        LH.SetPeriodAccess(d1, d2, 
False);
        LH.SetPeriodAccess(d2, d3, 
True);
        LH.SetPeriodAccess(d3, d4, 
False);
        LogonHP.WeekDayHours(i 
As CalendarDayOfWeek) := LH;
    
End For;
    
// Save changes
    MS.Apply;
    
// Check in license
    Lic := Null;
End Sub UserProc;

After executing the example, access parameters by days of week for the USER user are changed. Access under this user is available from Monday to Friday, from 9 AM till 6 PM.

See also:

ISecuritySubject