ConnectAsPrivilege: DalConnectAsPrivilegeType;
The ConnectAsPrivilege property determines connection to the database server with the specified privilege.
NOTE. The property is not intended to be used in application code. It is kept for compatibility with previous versions.
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 is locked for security reasons and only the SYS user is active.
To execute the example, make sure that the repository is on the Oracle server (Oracle DBMS type) and there is the SYS user with the Password password on the server.
Add links to 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 the SYSDBA privilege
Creds.ConnectAsPrivilege := DalConnectAsPrivilegeType.SYSDBA;
(Creds As IPasswordCredentials).UserName := "SYS";
(Creds As IPasswordCredentials).Password := "Password";
// Put credentials to cache to use during connection to create/change DBMS users
Mb.LogonSession.Credentials("$SYSTEM", True) := Creds;
// Update users
Se := Mb.Security;
UsUpd := Se.CreateUsersUpdate;
// Select all users for 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 the repository, credentials of the user with the SYSDBA privilege are specified.
See also: