IMetabaseSecurity.AddTemporaryUser

Syntax

AddTemporaryUser(UserName: String, Period: Integer):IMetabaseUser;

Description

The AddTemporaryUser method adds a temporary user with the specified period of use in days.

Example

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

Sub UserProc;
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    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;
    // Add a user with use period
    User := MS.AddTemporaryUser("USERNAME"2);
    // Set password
    Data := User.PackageData;
    Package := New StandardSecurityPackage.Create;
    PswCreds := Package.CreateCredentials(AuthenticationMode.Password) As IPasswordCredentials;
    PswCreds.Password := "Password";
    Data.Credentials := PswCreds;
    // Save changes
    MS.Apply;
    // Check in license
    Lic := Null;
End Sub UserProc;

After executing the example the temporary user account of the USERNAME user will be added that is available for use during two days.

See also:

IMetabaseSecurity