Class List Method List File List

# Module: Yast::SecurityWizardsInclude

Defined in:
  ../../src/include/security/wizards.rb

## Instance Method Summary (collapse)

- - (Object) initialize_security_wizards(include_target)
- - (Object) MainSequence

  Main workflow of the security configuration.

- - (Object) SecurityAutoSequence

  Whole configuration of security but without reading and writing.

- - (Object) SecuritySequence

  Whole configuration of security.

- - (Object) TreeDialog

## Instance Method Details

### - (`Object`) initialize_security_wizards(include_target)

    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    # File '../../src/include/security/wizards.rb', line 30

    def initialize_security_wizards(include_target)
      Yast.import "UI"

      textdomain "security"

      Yast.import "Label"
      Yast.import "Sequencer"
      Yast.import "Wizard"

      Yast.include include_target, "security/complex.rb"
      Yast.include include_target, "security/dialogs.rb"
      Yast.include include_target, "security/users.rb"
    end

### - (`Object`) MainSequence

Main workflow of the security configuration

Returns:

- (`Object`) —

  Returned value from WizardSequencer() call

    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    # File '../../src/include/security/wizards.rb', line 100

    def MainSequence
      aliases = {
        "main"     => lambda { MainDialog() },
        "password" => lambda { PassDialog() },
        "boot"     => lambda { BootDialog() },
        "login"    => lambda { LoginDialog() },
        "adduser"  => lambda { AdduserDialog() },
        "misc"     => lambda { MiscDialog() }
      }

      sequence = {
        "ws_start" => "main",
        "main"     => {
          :abort  => :abort,
          :next   => "password",
          :finish => :next
        },
        "password" => { :abort => :abort, :next => "boot" },
        "boot"     => { :abort => :abort, :next => "login" },
        "login"    => { :abort => :abort, :next => "adduser" },
        "adduser"  => { :abort => :abort, :next => "misc" },
        "misc"     => { :abort => :abort, :next => :next }
      }

      ret = Sequencer.Run(aliases, sequence)

      deep_copy(ret)
    end

### - (`Object`) SecurityAutoSequence

Whole configuration of security but without reading and writing. For use with autoinstallation.

Returns:

- (`Object`) —

  Returned value from WizardSequencer() call

    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    # File '../../src/include/security/wizards.rb', line 157

    def SecurityAutoSequence
      # Dialog caption
      caption = _("Security Configuration")
      # Label
      contents = Label(_("Initializing..."))

      Wizard.CreateDialog
      Wizard.SetDesktopTitleAndIcon("security")
      Wizard.SetContentsButtons(
        caption,
        contents,
        "",
        Label.BackButton,
        Label.NextButton
      )

      # Run the main configuration workflow
      ret = TreeDialog()

      UI.CloseDialog
      deep_copy(ret)
    end

### - (`Object`) SecuritySequence

Whole configuration of security

Returns:

- (`Object`) —

  Returned value from WizardSequencer() call

    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    # File '../../src/include/security/wizards.rb', line 131

    def SecuritySequence
      aliases = { "main" => lambda { TreeDialog() }, "write" => [lambda do
        WriteDialog()
      end, true] }

      sequence = {
        "ws_start" => "main",
        "main"     => { :abort => :abort, :finish => "write", :next => "write" },
        "write"    => { :abort => :abort, :next => :next }
      }

      Wizard.CreateDialog
      Wizard.SetDesktopTitleAndIcon("security")

      # Read has no progress and returns only true
      Security.Read

      ret = Sequencer.Run(aliases, sequence)

      UI.CloseDialog
      deep_copy(ret)
    end

### - (`Object`) TreeDialog

    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    # File '../../src/include/security/wizards.rb', line 44

    def TreeDialog
      Wizard.OpenTreeNextBackDialog
      tree = []

      # params: input tree, parent, label, id
      tree = Wizard.AddTreeItem(tree, "", _("Security Overview"), "overview")
      tree = Wizard.AddTreeItem(
        tree,
        "",
        _("Predefined Security Configurations"),
        "main"
      )
      tree = Wizard.AddTreeItem(tree, "", _("Password Settings"), "password")
      tree = Wizard.AddTreeItem(tree, "", _("Boot Settings"), "boot")
      tree = Wizard.AddTreeItem(tree, "", _("Login Settings"), "login")
      tree = Wizard.AddTreeItem(tree, "", _("User Addition"), "users")
      tree = Wizard.AddTreeItem(tree, "", _("Miscellaneous Settings"), "misc")

      Wizard.CreateTree(tree, "Security")

      ret = OverviewDialog()

      while true
        # needed for ncurses UI
        ret = Wizard.QueryTreeItem if ret == :wizardTree

        if ret == "main"
          ret = MainDialog()
        elsif ret == "overview"
          ret = OverviewDialog()
        elsif ret == "password"
          ret = PassDialog()
        elsif ret == "boot"
          ret = BootDialog()
        elsif ret == "login"
          ret = LoginDialog()
        elsif ret == "users"
          ret = AdduserDialog()
        elsif ret == "misc"
          ret = MiscDialog()
        elsif ret == :next || ret == :abort || ret == :finish
          break
        else
          Builtins.y2error("Unknown return value %1, aborting...", ret)
          ret = :abort
          break
        end
      end

      Wizard.CloseDialog

      deep_copy(ret)
    end