ICredentials.ConnectAsPrivilege

Syntax

ConnectAsPrivilege: DalConnectAsPrivilegeType;

Description

The ConnectAsPrivilege property determines connection to the server of databases with the specified privilege.

NOTE. The property is not intended to be used in application code. It is kept to be compatible with previous versions.

Comments

Connection with privileges may be required on executing operations in Foresight Analytics Platform that require to specify parameters of the account with active Oracle administrator permissions, for example, when the SYSTEM user account is locked for security reasons and only the SYS user is active.

Example

To execute the example make sure that repository is on the Oracle server (Oracle DBMS type is 9.x\10.x\11.x) and there is a SYS user with the Password password on the server.

Add the Metabase, Dal system assemblies.

Sub UserProc;
Var 
    Mb: IMetabase;
    MbDef: IMetabaseDefinition;
    Pack: ISecurityPackage;
    Creds: ICredentials;
    Se: IMetabaseSecurity;
    Us: IMetabaseUser;
    UsUpd: IMetabaseUsersUpdate;
    Lic: Object;
Begin 
    Mb := MetabaseClass.Active;
    
// Check out license to work with security manager
    Lic := Mb.RequestLicense(UiLicenseFeatureType.Adm);
    MbDef := Mb.Definition;
    Pack := MbDef.Manager.Packs.FindById(MbDef.SecurityPackage).Package;
    // Create password credentials
    Creds := Pack.CreateCredentials(AuthenticationMode.Password);
    // Set connection method with privilege SYSDBA
    Creds.ConnectAsPrivilege := DalConnectAsPrivilegeType.SYSDBA;
    (Creds As IPasswordCredentials).UserName := "SYS";
    (Creds As IPasswordCredentials).Password := "Password";
    // Place credentials to the cache for usage on connecting for creating/editing users of the DBMS
    Mb.LogonSession.Credentials("$SYSTEM"True) := Creds;
    // Update users
    Se := Mb.Security;
    UsUpd := Se.CreateUsersUpdate;
    // Select all the users for the update
    For Each Us In Se.Users Do
        UsUpd.Add(Us);
    End for;
    // Update selected users
    Se.UpdateUsers(UsUpd);
    // Save changes
    Se.Apply;
    
// Check in license
    Lic := Null;
End Sub UserProc;

After executing the example all repository users are updated. To connect to repository, credentials of the user with the SYSDBA privilege are specified.

See also:

ICredentials