GuidStr: String;
GuidStr: String;
The GuidStr property enables the user to get unique identifier of element of the attribute-based access control structure.
To execute the example, make sure that attribute-based access control contains a policies set with a nested policies set.
To execute the example, add links to the ABAC, Metabase, ForeSystem (for the Fore.NET example) system assemblies.
Sub Main;
Var
PolicyObject: IABACRootPolicyObject;
PolicySet, PolicySet2: IABACPolicySet;
MB: IMetabase;
MS: IMetabaseSecurity;
Lic: Object;
Begin
MB := MetabaseClass.Active;
// Get license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
MS := MB.Security;
PolicyObject := MB.Security.Policy.ABACRules;
// Get the first policies set in attribute-based access control structure
PolicySet := PolicyObject.Policies.Item(0);
// Get the first policies set in selected set
PolicySet2 := PolicySet.PolicySets.Item(0);
// Display unique identifier of policies set in the console
Debug.WriteLine("Unique identifier (Guid): " + PolicySet.GuidStr);
Debug.WriteLine("Unique identifier (Guid): " + PolicySet2.GuidStr);
// Check in license
Lic := Null;
End Sub Main;
Imports Prognoz.Platform.Interop.ABAC;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.ForeSystem;
…
Public Shared Sub Main(Params: StartParams);
Var
PolicyObject: IABACRootPolicyObject;
PolicySet, PolicySet2: IABACPolicySet;
MB: IMetabase;
MS: IMetabaseSecurity;
Lic: Object;
Begin
MB := Params.Metabase;
// Get license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
MS := MB.Security;
PolicyObject := MB.Security.Policy.ABACRules;
// Get the first policies set in attribute-based access control structure
PolicySet := PolicyObject.Policies.Item[0];
// Get the first policies set in selected set
PolicySet2 := PolicySet.PolicySets.Item[0];
// Display unique identifier of policies set in the console
System.Diagnostics.Debug.WriteLine("Unique identifier (Guid): " + PolicySet.GuidStr);
System.Diagnostics.Debug.WriteLine("Unique identifier (Guid): " + PolicySet2.GuidStr);
// Check in license
Lic := Null;
End Sub;
After executing the example the console displays unique identifiers of policies sets of attribute-based access control structure as a string:
Unique identifier (Guid): {31C234D0-73CB-4223-8829-AA8C58C2D0AD}
Unique identifier (Guid): {C49B51FD-DE78-4E64-9C0E-3C8C8336CE15}
See also: