IndexOf(Value: IABACPolicySet): Integer;
Value. Value of set of policies.
The IndexOf method returns index of the set of policies in attribute-based access control structure.
If the specified set of policies is not found, the method returns -1.
Indexing of sets of policies starts with zero.
To get attribute-based access control structure element by its index, use the IABACPolicySets.Item property.
To execute the example, make sure that attribute-based access control contains two sets of policies.
To execute the example, add links to the ABAC and Metabase system assemblies.
Sub UserProc;
Var
PolicyObject: IABACRootPolicyObject;
PolicySets: IABACPolicySets;
PolicySet: IABACPolicySet;
MB: IMetabase;
MS: IMetabaseSecurity;
Lic: Object;
Index: Integer;
Begin
MB := MetabaseClass.Active;
// Get license to be able to work with the security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
MS := MB.Security;
// Get attribute-based access control
PolicyObject := MB.Security.Policy.ABACRules;
PolicySets := PolicyObject.Policies;
// Add a policies set
PolicySet := PolicyObject.Policies.Add;
PolicySet.Name(MB.CurrentLocale) := "Test policies set";
// Get index of policies set
Index := PolicySets.IndexOf(PolicySet);
// Display name and index of policies set in the console
Debug.WriteLine(PolicySet.Name(MB.CurrentLocale));
Debug.WriteLine("Index = " + Index.ToString);
// Check in license
Lic := Null;
End Sub UserProc;
After executing the example the following message is displayed in the console:
Test set of policies
Index = 2
See also: