IDomains.Add

Syntax

Add(Name: String): IDomain;

Parameters

Name. Name of added domain.

Description

The Add method adds a domain to the collection.

Example

Executing the example requires that security manager contains the DOMAIN_USER domain user and the WORKSTATION station in the DOMAIN_TEST domain.

Add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    User: IMetabaseUser;
    Dms: IDomains;
    Dm: IDomain;
    Sts: IStations;
    St: IStation;
    Lic: Object;
Begin
    MB := MetabaseClass.Active;
    
// Check out license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
    MS := MB.Security;
    
// Get domain user parameters
    User := MS.ResolveName("DOMAIN_USER"As IMetabaseUser;
    Sts := User.Stations;
    Dms := Sts.Domains;
    
// Open user access to workstation in the specified domain
    Dm := Dms.Add("DOMAIN_TEST");
    Sts := Dm.Stations;
    Sts.Refresh;
    St := Sts.FindByName(
"WORKSTATION");
    St.Included := 
True;
    
// Save changes
    MS.Apply;
    
// Check in license
    Lic := Null;
End Sub UserProc;

After executing the example for the DOMAIN_USER user, the access policy will be changed. Access under this user will be allowed only from the WORKSTATION workstation included in the DOMAIN_TEST domain.

See also:

IDomains