ItemSetup(Index: Integer): IMetabaseSecuritySubjectUpdateSetup;
Index. User index in update list.
The ItemSetup property returns security subject update options.
To execute the example, add a link to the Metabase system assembly.
Sub UserProc;
Var
MB: IMetabase;
Sec: IMetabaseSecurity;
Users: IMetabaseUsers;
User: IMetabaseUser;
i: Integer;
UsUpdate: IMetabaseUsersUpdate;
Subj: ISecuritySubject;
Lic: Object;
Begin
MB := MetabaseClass.Active;
// Check out license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
Sec := MB.Security;
Users := Sec.Users;
// Create an update
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);
// Save changes
Sec.Apply;
// Check in license
Lic := Null;
End Sub UserProc;
After executing the example the console displays the list of updated users. If there is the user named NewUser, the update type is changed for him. As a result, all users are updated.
See also: