ShortName: String;
ShortName: System.String;
The ShortName property determines the short identifier of Oracle domain user.
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 links to the Metabase, ForeSystem (for the Fore.NET example) system assemblies.
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;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.ForeSystem;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MBSec: IMetabaseSecurity;
SubSearch: ISecuritySubjectsSearch;
Subjects: ISecuritySubjects;
Subject, AddedSubject: ISecuritySubject;
Date: String;
Lic: Object;
Begin
MB := Self.Metabase;
// Check out license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
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.sstUser] := 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
// Assign short name from the Date variable and random number
AddedSubject := MBSec.AddNTSubject(Subject);
(AddedSubject As IMetabaseUser).ShortName := Date + "1234567891";
End For;
// Save changes
MBSec.Apply();
// Check in license
Lic := Null;
End Sub;
After executing the example, all domain users, whose names satisfy the FS\BS* mask, are searched. The found users are added to a repository users list to whom the short name will be assigned.
See also: