Save(Writer: IXmlDomElement);
The Save method saves attribute-based access control structure to XML file.
To load saved attribute-based access control structure from XML file, use the IABACRootPolicyObject.Load method.
To execute the example, make sure that attribute-based access control contains element structure: policies set, policies, rules.
Add links to the ABAC, Metabase, Xml (use MsXml2 for the Fore.NET example) system assemblies.
Sub UserProc;
Var
PolicyObject: IABACRootPolicyObject;
MB: IMetabase;
MS: IMetabaseSecurity;
Xml: IXmlDomElement;
XmlDoc: IXmlDomDocument;
Begin
MB := MetabaseClass.Active;
MS := MB.Security;
// Get attribute-based access control structure
PolicyObject := MS.Policy.ABACRules;
// Save attribute-based access control structure to XML file
XmlDoc := New DOMDocument.Create;
Xml := XmlDoc.createElement("ABAC");
XmlDoc.appendChild(Xml);
PolicyObject.Save(Xml);
XmlDoc.save("C:\temp\ABAC.xml");
End Sub UserProc;
Imports Prognoz.Platform.Interop.ABAC;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.MsXml2;
…
Public Shared Sub Main(Params: StartParams);
Var
PolicyObject: IABACRootPolicyObject;
MB: IMetabase;
MS: IMetabaseSecurity;
Xml: IXmlDomElement;
XmlDoc: FreeThreadedDOMDocument60;
Begin
MB := Params.Metabase;
MS := MB.Security;
// Get attribute-based access control structure
PolicyObject := MS.Policy.ABACRules;
// Save structure to XML file
XmlDoc := New FreeThreadedDOMDocument60.Create();
Xml := XmlDoc.createElement("ABAC");
XmlDoc.appendChild(Xml);
PolicyObject.Save(Xml);
XmlDoc.save("C:\temp\ABAC.xml");
End Sub;
After executing the example the specified XML file contains attribute-based access control structure.
See also: