IMetabaseSecurity.Policy

Syntax

Policy: IMetabasePolicy;

Description

The Policy property returns the settings of the platform security policy.

Example

Executing the example requires the user, registered in the platform with the User_1 identifier.

Sub Main;

Var

MB: IMetabase;

MS: IMetabaseSecurity;

MP: IMetabasePolicy;

User: ISecuritySubject;

LogonHP: ILogonHoursPolicy;

LH: ILogonHours;

LHP: ILogonHoursPeriods;

d1, d2, d3, d4: DateTime;

Begin

MB := MetabaseClass.Active;

MS := MB.Security;

MP := MS.Policy;

User := MS.ResolveName("User_1");

LogonHP := MP.LogonHoursPolicy(User);

LHP := LogonHP.Periods;

LH := LHP.CreateHours;

d1 := DateTime.ComposeTimeOfDay(0, 0, 0, 0);

d2 := DateTime.ComposeTimeOfDay(9, 0, 0, 0);

d3 := DateTime.ComposeTimeOfDay(18, 0, 0, 0);

d4 := DateTime.ComposeTimeOfDay(23, 59, 0, 0);

LH.SetPeriodAccess(d1, d2, False);

LH.SetPeriodAccess(d2, d3, True);

LH.SetPeriodAccess(d3, d4, False);

d1 := DateTime.Now;

d2 := DateTime.AddDays(d1, 30);

LHP.SetPeriodAccess(d1, d2, LH);

MS.Apply;

End Sub Main;

After executing this example the parameters of access in the determined time period for the User_1 user are changed. Since this day and during the next 30 days access under this user has been possible from 9 a.m. to 6 p.m.

See also:

IMetabaseSecurity