ShortName: String;
ShortName: 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.
Before executing, the example requires a form containing the Button component with the Button1 identifier.
Add a link to the Metabase system assembly.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
MB: IMetabase;
MBSec: IMetabaseSecurity;
SubSearch: ISecuritySubjectsSearch;
Subjects: ISecuritySubjects;
Subject, AddedSubject: ISecuritySubject;
Date: String;
Begin
MB := MetabaseClass.Active;
MBSec := MB.Security;
//Object to search for users
SubSearch := MBSec.NewSubjectsSearch;
SubSearch.NameCriteria := "FS\BS*";
//Search only for domain users
SubSearch.AreaIncludeDB := False;
SubSearch.AreaIncludeNT := True;
SubSearch.SubjectCriteria(SecuritySubjectType.User) := True;
SubSearch.ExecuteSearch;
//Found users
Subjects := SubSearch.Subjects;
//Get the current date
Date := DateTime.Now.ToString;
//Add a user
For Each Subject In Subjects Do
AddedSubject := MBSec.AddNTSubject(Subject);
//Assign the short name from the Date variable and the random number
(AddedSubject As IMetabaseUser).ShortName := Date + "1234567891";
End For;
//Applying security policy
MBSec.Apply;
End Sub Button1OnClick;
Searching for all domain users, whose name meets the FS\BS* mask, is performed when executing the example. The found users are added to a repository users list to whom the short name will be assigned.
The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components.
Imports Prognoz.Platform.Interop.Metabase;
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
MB: IMetabase;
MBSec: IMetabaseSecurity;
SubSearch: ISecuritySubjectsSearch;
Subjects: ISecuritySubjects;
Subject, AddedSubject: ISecuritySubject;
Date: String;
Begin
MB := Self.Metabase;
MBSec := MB.Security;
//Object to search for users
SubSearch := MBSec.NewSubjectsSearch();
SubSearch.NameCriteria := "FS\BS*";
//Search only for domain users
SubSearch.AreaIncludeDB := False;
SubSearch.AreaIncludeNT := True;
SubSearch.SubjectCriteria[SecuritySubjectType.sstUser] := True;
SubSearch.ExecuteSearch();
//Found users
Subjects := SubSearch.Subjects;
//Get the current date
Date := DateTime.Now.ToString();
//Add a user
For Each Subject In Subjects Do
//Assign the short name from the Date variable and the random number
AddedSubject := MBSec.AddNTSubject(Subject);
(AddedSubject As IMetabaseUser).ShortName := Date + "1234567891";
End For;
//Applying security policy
MBSec.Apply();
End Sub;
See also: