ShortName: String;
The ShortName property determines a short identifier of Oracle domain user.
The identifier looks as follows: UYYYYMMDDhhmmsslllrrrrrrrrrr. Where: U - prefix, YYYY - year, MM - months, DD - day, hh - hours, mm - minutes, ss - seconds, lll - milliseconds, rrrrrrrrrr - random number.
To execute the example, make sure that security manager contains the USER user.
Add a link to the Metabase system assembly.
Sub UserProc;
Var
MB: IMetabase;
MBSec: IMetabaseSecurity;
SubSearch: ISecuritySubjectsSearch;
Subjects: ISecuritySubjects;
Subject, AddedSubject: ISecuritySubject;
Date: String;
Lic: Object;
Begin
MB := MetabaseClass.Active;
// Check out license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
MBSec := MB.Security;
// Set object to search for domain users
SubSearch := MBSec.NewSubjectsSearch;
SubSearch.NameCriteria := "FS\BS*";
SubSearch.AreaIncludeDB := False;
SubSearch.AreaIncludeNT := True;
SubSearch.SubjectCriteria(SecuritySubjectType.User) := True;
SubSearch.ExecuteSearch;
// Get found users
Subjects := SubSearch.Subjects;
// Get current date
Date := DateTime.Now.ToString;
// Add a user
For Each Subject In Subjects Do
AddedSubject := MBSec.AddNTSubject(Subject);
// Assign short name from the Date variable and random number
(AddedSubject As IMetabaseUser).ShortName := Date + "1234567891";
End For;
// Save changes
MBSec.Apply;
// Check in license
Lic := Null;
End Sub UserProc;
After executing the example, all domain users, whose names satisfy the FS\BS* mask, are searched. The found users are added to repository users list, to whom the short name will be assigned.
See also: