AddCopy(Value: IABACPolicySet): IABACPolicySet;
The AddCopy method adds a copy of the specified sets of policies to attribute-based access control structure.
To execute the example, make sure that attribute-based access control structure contains two sets of policies. The first set of policies contains an additional nested set of policies.
Add links to the ABAC and Metabase system assemblies.
Sub UserProc;
Var
PolicyObject: IABACRootPolicyObject;
PolicySet, Sets: IABACPolicySet;
PolicySets: IABACPolicySets;
MB: IMetabase;
MS: IMetabaseSecurity;
Lic: Object;
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;
// Get the first policies set in the policies set with the 0 index
PolicySet := PolicyObject.Policies.Item(0);
PolicySets := PolicySet.PolicySets;
Sets := PolicySets.Item(0);
// Get policies set with the 1 index
PolicySet := PolicyObject.Policies.Item(1);
PolicySets := PolicySet.PolicySets;
// Copy the first policies set from the policies set with the 0 index to the policies set with the 1 index
PolicySets.AddCopy(Sets);
// Rename the copied policies set
PolicySets.Item(0).Name(MB.CurrentLocale) := "Copied policies set";
// Apply changes in security manager
MS.Apply;
// Check in license
Lic := Null;
End Sub UserProc;
After executing the example the existing set of policies with the 0 index and new name is copied to the specified set of policies with the 1 index:

See also: