ItemSetup(Index: Integer): IMetabaseSecuritySubjectUpdateSetup;
ItemSetup[System.Int32]: 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 links to the Metabase, ForeSystem (for the Fore.NET example) system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Sec: IMetabaseSecurity;
Users: IMetabaseUsers;
User: IMetabaseUser;
i: Integer;
UsUpdate: IMetabaseUsersUpdate;
Subj: ISecuritySubject;
Lic: Object;
Begin
MB := MetabaseClass.Active;
// Get 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;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.ForeSystem;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Sec: IMetabaseSecurity;
Users: IMetabaseUsers;
User: IMetabaseUser;
i: Integer;
UsUpdate: IMetabaseUsersUpdate;
Subj: ISecuritySubject;
Lic: Object;
Begin
MB := Params.Metabase;
// Get license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
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.mesesuuptyDBGrant;
End If;
End For;
For i := 0 To UsUpdate.Count - 1 Do
Subj := UsUpdate.ItemSetup[i].Subject;
System.Diagnostics.Debug.Writeline(i.ToString() + ". Name: " + Subj.Name);
End For;
Sec.UpdateUsers(UsUpdate);
// Save changes
Sec.Apply();
// Check in license
Lic := Null;
End Sub;
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: