ItemSetup(Index: Integer): IMetabaseSecuritySubjectUpdateSetup;
ItemSetup(Index: Integer): Prognoz.Platform.Interop.Metabase.IMetabaseSecuritySubjectUpdateSetup;
Index. Index of a user in a list of update.
The ItemSetup property returns settings of update of a security subject.
To execute the example, add the Metabase system assembly to the module.
Sub UserProc;
Var
Sec: IMetabaseSecurity;
Users: IMetabaseUsers;
User: IMetabaseUser;
i: Integer;
UsUpdate: IMetabaseUsersUpdate;
Subj: ISecuritySubject;
Begin
Sec := MetabaseClass.Active.Security;
Users := Sec.Users;
UsUpdate := Sec.CreateUsersUpdate;
For i := 0 To Users.Count - 1 Do
User := Users.Item(i);
UsUpdate.Add(User);
If User.Name = "NewUser" Then
UsUpdate.ItemSetup(i).UpdateType := MetabaseSecuritySubjectUpdateType.DBGrant;
End If;
End For;
For i := 0 To UsUpdate.Count - 1 Do
Subj := UsUpdate.ItemSetup(i).Subject;
Debug.Writeline(i.ToString + ". Name: " + Subj.Name);
End For;
Sec.UpdateUsers(UsUpdate);
End Sub UserProc;
After executing this example a list of updated users is displayed into console window. If there is the user with the NewUser name the update type is changed for him. All repository users are updated.
Executing the example requires a .NET form with a button named Button1 and a component named ListBox1.
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
Sec: IMetabaseSecurity;
Users: IMetabaseUsers;
User: IMetabaseUser;
i: Integer;
UsUpdate: IMetabaseUsersUpdate;
Subj: ISecuritySubject;
Begin
Sec := Self.Metabase.Security;
Users := Sec.Users;
UsUpdate := Sec.CreateUsersUpdate();
For i := 0 To Users.Count - 1 Do
User := Users.Item[i];
UsUpdate.Add(User);
If User.Name = "NewUSER" Then
UsUpdate.ItemSetup[i].UpdateType := MetabaseSecuritySubjectUpdateType.mesesuuptyDBGrant;
End If;
End For;
For i := 0 To UsUpdate.Count - 1 Do
Subj := UsUpdate.ItemSetup[i].Subject;
ListBox1.Items.Add(i.ToString() + ". Name: " + Subj.Name);
End For;
Sec.UpdateUsers(UsUpdate);
End Sub;
On clicking the button a list of updated users is displayed. If there is the user with the NewUser name, the update type is changed for him. All repository users are updated.
See also: