IMetabaseGroup.AddMember

Syntax

AddMember(Subject: ISecuritySubject);

Parameters

Subject. Security subject that needs to be added.

Description

The AddMember method adds a security subject passed as an input parameter to the current group.

Example

To execute the example, add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    Group: IMetabaseGroup;
    User: IMetabaseUser;
    Data: ISecurityPackageUserData;
    Package: ISecurityPackage;
    PswCreds: IPasswordCredentials;
    Lic: Object;
Begin
    MB := MetabaseClass.Active;
    // Get license to be able to work with the security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
    MS := MB.Security;
    Group := MS.Groups.Item(0);
    // Set new user parameters
    User := MS.AddUser("USER_NEW");
    User.FullName := "First user";
    User.Description := "New platform user";
    Data := User.PackageData;
    Package := New StandardSecurityPackage.Create;
    PswCreds := Package.CreateCredentials(AuthenticationMode.Password) As IPasswordCredentials;
    PswCreds.Password := "Password";
    Data.Credentials := PswCreds;
    User.MustChangePasswordAtNextLogon := True;
    // Add a new user to the first group
    Group.AddMember(User);
    // Save changes
    MS.Apply;
    // Check in license
    Lic := Null;
End Sub UserProc;

After executing the example the USER_NEW new user is created. This user is added to the first group created in the security manager. On the first login to the platform under this user, the request for password changing will be displayed.

See also:

IMetabaseGroup