Parent: Object;
Parent: Object;
The Parent property enables the user to get parent element for the specified element ofattribute-based access control structure.
The first level of elements hierarchy is used as the top parent element.
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;
Parent: Object;
s: string;
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);
//Set parent element for selected set
Parent := PolicySet2.Parent;
//Determine whether parent element is on the first hierarchy level
If Parent <> Null Then
s := s + "parent";
If Parent Is IABACRootPolicyObject Then
s := s + " is a root";
Else
s := s + " is not a root";
End If;
Else
s := s + "parent is empty";
End If;
Debug.WriteLine(s);
// 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;
Parent: Object;
s: string;
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];
//Set parent element for selected set
Parent := PolicySet2.Parent;
//Determine whether parent element is on the first hierarchy level
If Parent <> Null Then
s := s + "parent";
If Parent Is IABACRootPolicyObject Then
s := s + " is a root";
Else
s := s + " is not a root";
End If;
Else
s := s + "parent is empty";
End If;
System.Diagnostics.Debug.WriteLine(s);
// Check in license
Lic := Null;
End Sub;
After executing the example, the console displays the message:
parent is not a root
See also: