ISecuritySnapshot.SaveToFile

Syntax

SaveToFile(FileName: String);

SaveToFile(FileName: System.String);

Parameters

FileName. The path to the security policy file, to which the security policy will be saved (*.pppolicy).

Description

The SaveToFile method saves the security policy into the file.

Example

To execute the example, add links to the Metabase, ForeSystem (for the Fore.NET example) system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    Sna: ISecuritySnapshot;
    Log: ISecuritySnapshotLog;
    sFile: String;
    Lic: Object;
Begin
    MB := MetabaseClass.Active;
    
// Get license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
    MS := MB.Security;
    Sna := MS.NewSnapshot;
    
// Save security policy to file
    sFile := "c:\" + Sna.Metabase.Name + ".pppolicy";
    Sna.SaveToFile(sFile);
    Log := Sna.Log;
    
While Not Log.Eof Do
        Debug.WriteLine(Log.Message);
        Log.Next;
    
End While;
    
// Check in license
    Lic := Null;
End Sub UserProc;

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.ForeSystem;

Public Shared Sub Main(Params : StartParams);
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    Sna: ISecuritySnapshot;
    Log: ISecuritySnapshotLog;
    sFile: String;
    Lic: Object;
Begin
    MB := Params.Metabase;
    
// Get license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
    MS := MB.Security;
    Sna := MS.NewSnapshot();
    
// Save security policy to file
    sFile := "c:\" + Sna.Metabase.Name + ".pppolicy";
    Sna.SaveToFile(sFile);
    Log := Sna.Log;
    
While Not Log.Eof() Do
        System.Diagnostics.Debug.WriteLine(Log.Message);
        Log.Next();
    
End While;
    
// Check in license
    Lic := Null;
End Sub;

After executing the example the security policy is saved to the specified file, which name corresponds to the repository name.

See also:

ISecuritySnapshot