IMetabaseUser.InitCertificate

Syntax

InitCertificate(StorageType: CertificateStorageType);

InitCertificate(StorageType: Prognoz.Platform.Interop.Metabase.CertificateStorageType);

Description

The InitCertificate gets certificate from the storage, executes certificate copy and assigns the obtained value in IMetabaseUser.Certificate.

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;
    User: IMetabaseUser;
    Lic: Object;
Begin
    MB := MetabaseClass.Active;
    
// Get license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
    MS := MB.Security;
    
// Add certificate from file and assign certificate copy to the ADMIN user
    User := MS.ResolveName("ADMIN"As IMetabaseUser;
    User.InitCertificate(CertificateStorageType.File);
    
// Save changes
    MS.Apply;
    
// 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;
    User: IMetabaseUser;
    Lic: Object;
Begin
    MB := Params.Metabase;
    
// Get license to work with security manager
    Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
    MS := MB.Security;
    
// Add certificate from file and assign certificate copy to the ADMIN user
    User := MS.ResolveName("ADMIN"As IMetabaseUser;
    User.InitCertificate(CertificateStorageType.cstFile);
    
// Save changes
    MS.Apply();
    
// Check in license
    Lic := Null;
End Sub;

After executing the example the certificate copy from the selected file is assigned to the ADMIN user.

See also:

IMetabaseUser