Load(Reader: IXmlDomElement);
The Load method loads attribute-based access control structure from XML file.
It is used to create the attribute-based access control that is not connected with general security policy. Loaded structure of attribute-based access control from XML file is not loaded in the security manager interface.
To save attribute-based access control structure to XML file, use the IABACRootPolicyObject.Save method.
To execute the example make sure that XML file contains a structure of attribute-based access control elements: policies set, policies, rules.
Add links to the ABAC, Metabase, Ui, and Xml system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MS: IMetabaseSecurity;
PolicyObject: IABACRootPolicyObject;
XMLDoc: IXMLDOMDocument;
XMLElem: IXMLDOMElement;
XMLName, XMLElemName: String;
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;
// Load attribute-based access control structure from XML file
XMLName:= "C:\temp\ABAC.xml";
XMLElemName:= "ABAC";
XMLDoc := New DOMDocument60.Create;
If XMLDoc.load(XMLName) Then
XMLElem := XMLDoc.selectSingleNode(XMLElemName) As IXmlDomElement;
If XMLElem <> Null Then
MS.Policy.ABACRules.Load(XMLElem);
MS.Apply;
Else
WinApplication.ErrorBox("The specified element is not found");
End If;
Else
WinApplication.ErrorBox("Error loading XML");
End If;
// Check in license
Lic := Null;
End Sub UserProc;
After executing the example the attribute-based access control structure will be downloaded from XML file. If any errors occur on downloading XML file or the ABAC element will not be found in the file, the corresponding message is displayed.
See also: