IMetabaseUser.InitCertificate

Syntax

InitCertificate(StorageType: CertificateStorageType);

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

Description

The Certificate Method returns the certificate selected by certificate storage and assigns the obtained value to 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 for 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 for 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 valid certificate from the selected file is assigned to the ADMIN user.

See also:

IMetabaseUser