Name: String;
Name: System.String;
The Name property returns the name of the security subject.
To execute the example, make sure that the D:\ drive contains the Update.pefx update file.
Add links to the Metabase, ForeSystem (for the Fore.NET example) system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
Upd: IMetabaseUpdate;
RootFolder: IMetabaseUpdateFolderNode;
Subj: IMetabaseUpdateAccessSubject;
Subjs: IMetabaseUpdateAccessSubjects;
Se: IMetabaseSecurity;
Lic: Object;
Begin
Mb := MetabaseClass.Active;
// Get license to work with security manager
Lic := Mb.RequestLicense(UiLicenseFeatureType.Adm);
Upd := Mb.CreateUpdate;
Upd.LoadFromFileNF("D:\Update.pefx");
Upd.AllowReplaceSD := True;
RootFolder := Upd.RootFolder;
Subjs := Upd.Subjects;
Debug.WriteLine("Number of security subjects used in access permissions update: ");
Se := Mb.Security;
For Each Subj In Subjs Do
Debug.WriteLine(Subj.Name);
Debug.WriteLine(Subj.Description);
Debug.WriteLine(Subj.Sid.AsString);
End For;
// Save changes
Se.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;
Upd: IMetabaseUpdate;
RootFolder: IMetabaseUpdateFolderNode;
Subj: IMetabaseUpdateAccessSubject;
Subjs: IMetabaseUpdateAccessSubjects;
Se: IMetabaseSecurity;
Lic: Object;
Begin
Mb := Params.Metabase;
// Get license to work with security manager
Lic := Mb.RequestLicense(UiLicenseFeatureType.lftAdm);
Upd := Mb.CreateUpdate();
Upd.LoadFromFileNF("D:\"+ "Update.pefx", UpdateLoadMode.ulmReplace);
Upd.AllowReplaceSD := True;
RootFolder := Upd.RootFolder;
Subjs := Upd.Subjects;
System.Diagnostics.Debug.WriteLine("Number of security subjects used in access permissions update: ");
Se := Mb.Security;
For Each subj In subjs Do
System.Diagnostics.Debug.WriteLine(Subj.Name);
System.Diagnostics.Debug.WriteLine(Subj.Description);
System.Diagnostics.Debug.WriteLine(Subj.Sid.AsString);
End For;
// Save changes
Se.Apply();
// Check in license
Lic := Null;
End Sub;
After executing the example the console displays information about all security subjects, for which object access permissions will be updated.
See also: