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 enables the user to get access to creating tables on the DBMS level only from Prognoz Platform 9. 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. This 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. Configuration of automatic connection does not affect using of application role.
Executing this 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 assigned for it.
See also: