IMetabaseUsersUpdate.AddSubject

Syntax

AddSubject(Value: ISecuritySubject; UpdateType: MetabaseSecuritySubjectUpdateType);

AddSubject(Value: Prognoz.Platform.Interop.Metabase.ISecuritySubject; UpdateType: Prognoz.Platform.Interop.Metabase.MetabaseSecuritySubjectUpdateType);

Parameters

Value. Security subject of Foresight Analytics Platform: user or domain group of users.

UpdateType. Type of update.

Description

The AddSubject method adds a subject (a user or a domain users group) in a list for update.

Example

To execute the example, make sure that the security manager contains a domain user group named GROUP\TESTGROUP.

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

Sub UserProc;
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    Lic: Object;
    UsUp: IMetabaseUsersUpdate;
    Subj: ISecuritySubject;
Begin
    MB := MetabaseClass.Active;
    
// Check out license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
    MS := MB.Security;
    
// Create an update
    UsUp := MS.CreateUsersUpdate;
    Subj := MS.ResolveName(
"GROUP\TESTGROUP"As ISecuritySubject;
    UsUp.AddSubject(Subj, MetabaseSecuritySubjectUpdateType.DBGrant);
    
// Update group members
    MS.UpdateUsers(UsUp);
    
// 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;
    Lic: Object;
    UsUp: IMetabaseUsersUpdate;
    Subj: ISecuritySubject;
Begin
    MB := Params.Metabase;
    
// Check out license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
    MS := MB.Security;
    
// Create an update
    UsUp := MS.CreateUsersUpdate();
    Subj := MS.ResolveName(
"GROUP\TESTGROUP"As ISecuritySubject;
    UsUp.AddSubject(Subj, MetabaseSecuritySubjectUpdateType.mesesuuptyDBGrant);
    
// Update group members
    MS.UpdateUsers(UsUp);
    
// Save changes
    MS.Apply();
    
// Check in license
    Lic := Null;
End Sub;

After executing the example, the domain user group named GROUP\TESTGROUP is updated.

See also:

IMetabaseUsersUpdate