Class: Registration::UI::ImportCertificateDialog

Inherits:
Object
  • Object
show all
Extended by:
Yast::I18n
Includes:
Yast::I18n, Yast::Logger, Yast::UIShortcuts
Defined in:
src/lib/registration/ui/import_certificate_dialog.rb

Overview

this class displays and runs the dialog for importing a SSL certificate

Constant Summary collapse

OPENSSL_ERROR_MESSAGES =
Note:

the text messages need to be translated at runtime via _() call

error code => translatable error message

{
  # SSL error message
  10 => N_("Certificate has expired"),
  # SSL error message
  18 => N_("Self signed certificate"),
  # SSL error message
  19 => N_("Self signed certificate in certificate chain")
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cert) ⇒ ImportCertificateDialog

the constructor


43
44
45
46
# File 'src/lib/registration/ui/import_certificate_dialog.rb', line 43

def initialize(cert)
  textdomain "registration"
  @certificate = cert
end

Instance Attribute Details

#certificateObject

Returns the value of attribute certificate


16
17
18
# File 'src/lib/registration/ui/import_certificate_dialog.rb', line 16

def certificate
  @certificate
end

Class Method Details

.run(cert) ⇒ Symbol

create a new dialog for importing a SSL certificate and run it


36
37
38
39
# File 'src/lib/registration/ui/import_certificate_dialog.rb', line 36

def self.run(cert)
  dialog = ImportCertificateDialog.new(cert)
  dialog.run
end

Instance Method Details

#runSymbol

display the dialog and wait for a button click


50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'src/lib/registration/ui/import_certificate_dialog.rb', line 50

def run
  log.info "Certificate import dialog: issuer: #{certificate.issuer_name}, " \
    "subject: #{certificate.subject_name}, SHA1: " \
    "#{certificate.fingerprint(Fingerprint::SHA1).value}"

  Yast::UI.OpenDialog(Opt(:decorated), import_dialog_content)

  begin
    handle_dialog
  ensure
    Yast::UI.CloseDialog
  end
end