FindByGuidStr(GuidStr: String): IABACEvaluatedObject;
FindByGuidStr(String): Prognoz.Platform.Interop.ABAC.IABACEvaluatedObject;
The FindByGuidStr method searches for attribute-based access control structure element by unique identifier.
To execute the example, make sure that attribute-based access control contains policies set with nested policy.
To execute the example, add links to the ABAC, Metabase, ForeSystem (for the Fore.NET example) system assemblies.
Sub Main;
Var
PolicyObject: IABACRootPolicyObject;
PolicySet: IABACPolicySet;
Policies: IABACPolicies;
Policy: IABACEvaluatedObject;
Guid: 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;
// Get attribute-based access control structure
PolicyObject := MB.Security.Policy.ABACRules;
// Get policy with the 0 index in the first policies set
PolicySet := PolicyObject.Policies.Item(0);
Policies := PolicySet.Policies;
Policy := Policies.Item(0);
//Find attribute-based access control structure by unique identifier
Guid := PolicyObject.FindByGuidStr(Policy.GuidStr);
// Display name and unique identifier of policies set to the console
Debug.WriteLine(Policy.Name(MB.CurrentLocale)); // name
Debug.WriteLine(Policy.GuidStr); // unique 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;
PolicySet: IABACPolicySet;
Policies: IABACPolicies;
Policy: IABACEvaluatedObject;
Guid: 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;
// Get attribute-based access control structure
PolicyObject := MB.Security.Policy.ABACRules;
// Get policy with the 0 index in the first policies set
PolicySet := PolicyObject.Policies.Item[0];
Policies := PolicySet.Policies;
Policy := Policies.Item[0];
//Find attribute-based access control structure by unique identifier
Guid := PolicyObject.FindByGuidStr(Policy.GuidStr);
// Display name and unique identifier of policies set to the console
System.Diagnostics.Debug.WriteLine(Policy.Name[MB.CurrentLocale]); // name
System.Diagnostics.Debug.WriteLine(Policy.GuidStr); // unique identifier
// Check in license
Lic := Null;
End Sub;
After executing the example the console displays name and unique identifier of the specified policy, for example:
Test policies set
{8AFCD069-B6DC-4205-A76C-7FF28AD78199}
See also: