FindByGuidStr(GuidStr: String): IABACEvaluatedObject;
FindByGuidStr(String): Prognoz.Platform.Interop.ABAC.IABACEvaluatedObject;
The FindByGuidStr method searches for attribute-based access control structure by unique identifier.
To execute the example, make sure that attribute-based access control contains a 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;
Policy: IABACEvaluatedObject;
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;
//Find attribute-based access control structure by unique identifier
Policy := PolicyObject.FindByGuidStr("{31C234D0-73CB-4223-8829-AA8C58C2D0AD}");
// Display unique identifier of policies set in the console
Debug.WriteLine(Policy.Name(MB.CurrentLocale)); // name
Debug.WriteLine(Policy.Key); // key
Debug.WriteLine(Policy.Id); // identifier
// 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;
Policy: IABACEvaluatedObject;
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;
//Find attribute-based access control structure by unique identifier
Policy := PolicyObject.FindByGuidStr("{31C234D0-73CB-4223-8829-AA8C58C2D0AD}");
// Display unique identifier of policies set in the console
System.Diagnostics.Debug.WriteLine(Policy.Name[MB.CurrentLocale]); // name
System.Diagnostics.Debug.WriteLine(Policy.Key); // key
System.Diagnostics.Debug.WriteLine(Policy.Id); // identifier
// Check in license
Lic := Null;
End Sub;
After executing the example the console displays name, key and identifier of the specified policy:
Test policies set
37
PLCST37
See also: