Role: IDatabaseApplicationRole;
The Role property determines settings of using the application role.
Application role is a role at DBMS MS SQL level, having rights to create tables in the specified scheme and grant access rights for these tables. Application role allows getting access to creating tables on the DBMS level only from Foresight Analytics Platform. For example, if a user creates new tables, but has no rights to create tables in the chosen database and no rights to grant access to these tables, the database authorization window is opened by default. Using application role in this case enables user to perform the connection to database with role credentials without occurrence of authorization dialog. Further the operations with tables are performed under established connection.
By default the application role is not used. The option is enabled when the type of DBMS client is set to Microsoft SQL Server in settings of connection to database, or this type of DBMS client is inherited from connection to repository. Setup of automatic connection does not affect using of application role.
Executing the example requires the EditBox1 and EditBox2 components of the EditBox type located on the form. The scheme should have a database with the DB identifier using a type of DBMS client, that is Microsoft SQL Server.
Sub UserProc;
Var
MB : IMetabase;
DbObj: IMetabaseObject;
Db : IDatabase;
Role : IDatabaseApplicationRole;
Begin
MB := MetabaseClass.Active;
DbObj := MB.ItemById("DB").Edit;
Db := DbObj As iDatabase;
Role := Db.Role;
If Role.Mode=DatabaseApplicationRoleMode.Off Then
Role.Mode := DatabaseApplicationRoleMode.On_;
Role.Name := EditBox1.Text;
Role.Password := EditBox2.Text;
End If;
DbObj.Save;
End Sub UserProc;
After executing the example, using of application role is enabled and credentials are set for it.
See also: