PolicySets: IABACPolicySets;
PolicySets: Prognoz.Platform.Interop.ABAC.IABACPolicySets;
The PolicySets property is used to work with the policies sets collection.
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 UserProc;
Var
PolicyObject: IABACRootPolicyObject;
PolicySet, EditSet: 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;
// Change description of the first policies set in set
PolicySet := PolicyObject.Policies.Item(0); // the first policies set in attribute-based access control structure
EditSet := PolicySet.PolicySets.Item(0); // the first policies set in selected set
EditSet.Description(MB.CurrentLocale) := "Test policies set";
// Deactivate policies set in attribute-based access control structure
EditSet.Active := False;
// Display key of changed policies set in the console
Debug.WriteLine("Policies set key: " + EditSet.Key.ToString);
// Apply changes in security manager
MS.Apply;
// Check in license
Lic := Null;
End Sub UserProc;
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, EditSet: 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;
// Change description of the first policies set in set
PolicySet := PolicyObject.Policies.Item[0]; // the first policies set in attribute-based access control structure
EditSet := PolicySet.PolicySets.Item[0]; // the first policies set in selected set
EditSet.Description[MB.CurrentLocale] := "Test policies set";
// Deactivate policies set in attribute-based access control structure
EditSet.Active := False;
// Display key of changed policies set in the console
System.Diagnostics.Debug.WriteLine("Policies set key: " + EditSet.Key.ToString());
// Apply changes in security manager
MS.Apply();
// Check in license
Lic := Null;
End Sub;
After executing the example the nested policies set description is changed in attribute-based access control, and the checkbox that determines policies set activity is deselected in attribute-based access control structure:
The console displays the key of the nested policies set:
Policies set key: 123
See also: