Add(Name: String): IDomain;
Add(System.String): Prognoz.Platform.Interop.Metabase.IDomain;
Name. Name of added domain.
The Add method adds a domain to the collection.
Executing the example requires that security manager contains the DOMAIN_USER domain user and the WORKSTATION station in the DOMAIN_TEST domain.
Add links to the Metabase, ForeSystem (for the Fore.NET example) system assemblies.
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;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.ForeSystem;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MS: IMetabaseSecurity;
User: IMetabaseUser;
Dms: IDomains;
Dm: IDomain;
Sts: IStations;
St: IStation;
Lic: Object;
Begin
MB := Params.Metabase;
// Check out license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
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;
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: