ISecurityConnection.RolesRevoke

Syntax

RolesRevoke: IBitArray;

Description

The RolesRevoke property returns the array that contains indicators of roles that a user has.

Comments

Each element of the array contains an indicator, showing if user has a corresponding role. List of roles names is available in the UserRoles property. It is relevant if a role type of user authentication is used.

Example

Sub Main;

Var

Man: IMetabaseManager;

Package: ISecurityPackage;

MSSQLSPLD: IPrimaryMsSqlSPLD;

Cred: IPasswordCredentials;

Connection: ISecurityConnection;

RoleName: IStringList;

RoleRevoke: IBitArray;

i: Integer;

Begin

Man := MetabaseManagerFactory.Active;

Package := Man.Packs.Item(0).Package;

MSSQLSPLD := Package.CreateLogonData("MSSQL2008") As IPrimaryMsSqlSPLD;

MSSQLSPLD.Database := "Test_Schema_MSSQL";

MSSQLSPLD.Server := "Test_MSSQL";

Cred := Package.CreateCredentials(AuthenticationMode.Role) As IPasswordCredentials;

Cred.UserName := "TestUser";

Cred.Password := "TestUser";

Connection := Package.PerformLogonRoleO(1, MSSQLSPLD, Cred, 0, 0);

RoleName := Connection.UserRoles;

RoleRevoke := Connection.RolesRevoke;

For i := 0 To RoleName.Count - 1 Do

If RoleRevoke.Item(i) Then

Debug.WriteLine("The user is given the role: " + RoleName.Item(i));

Else

Debug.WriteLine("The user has no role: " + RoleName.Item(i));

End If;

End For;

End Sub Main;

After executing the example a new connection to the Test_Schema_MSSQL schema, located on the Test_MSSQL server, is performed with the specified credentials. Connection is performed with checking of role of the specified user. List of roles, with which a user is associated, is displayed in the development environment console.

See also:

ISecurityConnection

ISecurityConnection.UserRoles