• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

yast / yast-security / 7348705966

28 Dec 2023 02:50PM UTC coverage: 39.237% (-0.3%) from 39.568%
7348705966

Pull #157

github

web-flow
Merge 7db7fc531 into a9a6f29de
Pull Request #157: Update rubocop

68 of 442 new or added lines in 17 files covered. (15.38%)

40 existing lines in 4 files now uncovered.

1378 of 3512 relevant lines covered (39.24%)

5.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/include/security/wizards.rb
1
# ------------------------------------------------------------------------------
2
# Copyright (c) 2006-2012 Novell, Inc. All Rights Reserved.
3
#
4
#
5
# This program is free software; you can redistribute it and/or modify it under
6
# the terms of version 2 of the GNU General Public License as published by the
7
# Free Software Foundation.
8
#
9
# This program is distributed in the hope that it will be useful, but WITHOUT
10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License along with
14
# this program; if not, contact Novell, Inc.
15
#
16
# To contact Novell about this file by physical or electronic mail, you may find
17
# current contact information at www.novell.com.
18
# ------------------------------------------------------------------------------
19

20
# File:        include/security/wizards.ycp
21
# Package:        Security configuration
22
# Summary:        Wizards definitions
23
# Authors:        Michal Svec <msvec@suse.cz>
24
#
25
# $Id$
26
module Yast
×
27
  module SecurityWizardsInclude
×
28
    def initialize_security_wizards(include_target)
×
29
      Yast.import "UI"
×
30

31
      textdomain "security"
×
32

33
      Yast.import "Label"
×
34
      Yast.import "Sequencer"
×
35
      Yast.import "Wizard"
×
36

37
      Yast.include include_target, "security/complex.rb"
×
38
      Yast.include include_target, "security/dialogs.rb"
×
39
      Yast.include include_target, "security/users.rb"
×
40
    end
×
41

42
    def TreeDialog
×
43
      Wizard.OpenTreeNextBackDialog
×
44
      tree = []
×
45

46
      # params: input tree, parent, label, id
47
      tree = Wizard.AddTreeItem(tree, "", _("Security Overview"), "overview")
×
48
      tree = Wizard.AddTreeItem(
×
49
        tree,
×
50
        "",
×
51
        _("Predefined Security Configurations"),
×
52
        "main"
×
53
      )
×
54
      tree = Wizard.AddTreeItem(tree, "", _("Password Settings"), "password")
×
55
      tree = Wizard.AddTreeItem(tree, "", _("Boot Settings"), "boot")
×
56
      tree = Wizard.AddTreeItem(tree, "", _("Login Settings"), "login")
×
57
      tree = Wizard.AddTreeItem(tree, "", _("User Addition"), "users")
×
58
      tree = Wizard.AddTreeItem(tree, "", _("Miscellaneous Settings"), "misc")
×
59

60
      Wizard.CreateTree(tree, _("Security"))
×
61

62
      ret = OverviewDialog()
×
63

NEW
64
      loop do
×
65
        # needed for ncurses UI
66
        ret = Wizard.QueryTreeItem if ret == :wizardTree
×
67

NEW
68
        case ret
×
NEW
69
        when "main"
×
70
          ret = MainDialog()
×
NEW
71
        when "overview"
×
72
          ret = OverviewDialog()
×
NEW
73
        when "password"
×
74
          ret = PassDialog()
×
NEW
75
        when "boot"
×
76
          ret = BootDialog()
×
NEW
77
        when "login"
×
78
          ret = LoginDialog()
×
NEW
79
        when "users"
×
80
          ret = AdduserDialog()
×
NEW
81
        when "misc"
×
82
          ret = MiscDialog()
×
NEW
83
        when :next, :abort, :finish
×
84
          break
×
85
        else
×
86
          Builtins.y2error("Unknown return value %1, aborting...", ret)
×
87
          ret = :abort
×
88
          break
×
89
        end
×
90
      end
×
91

92
      Wizard.CloseDialog
×
93

94
      deep_copy(ret)
×
95
    end
×
96

97
    # Main workflow of the security configuration
98
    # @return [Object] Returned value from WizardSequencer() call
99
    def MainSequence
×
100
      aliases = {
×
NEW
101
        "main"     => -> { MainDialog() },
×
NEW
102
        "password" => -> { PassDialog() },
×
NEW
103
        "boot"     => -> { BootDialog() },
×
NEW
104
        "login"    => -> { LoginDialog() },
×
NEW
105
        "adduser"  => -> { AdduserDialog() },
×
NEW
106
        "misc"     => -> { MiscDialog() }
×
UNCOV
107
      }
×
108

109
      sequence = {
×
110
        "ws_start" => "main",
×
111
        "main"     => {
×
NEW
112
          abort:  :abort,
×
NEW
113
          next:   "password",
×
NEW
114
          finish: :next
×
115
        },
×
NEW
116
        "password" => { abort: :abort, next: "boot" },
×
NEW
117
        "boot"     => { abort: :abort, next: "login" },
×
NEW
118
        "login"    => { abort: :abort, next: "adduser" },
×
NEW
119
        "adduser"  => { abort: :abort, next: "misc" },
×
NEW
120
        "misc"     => { abort: :abort, next: :next }
×
UNCOV
121
      }
×
122

123
      ret = Sequencer.Run(aliases, sequence)
×
124

125
      deep_copy(ret)
×
126
    end
×
127

128
    # Whole configuration of security
129
    # @return [Object] Returned value from WizardSequencer() call
130
    def SecuritySequence
×
NEW
131
      aliases = { "main" => -> { TreeDialog() }, "write" => [lambda do
×
132
        WriteDialog()
×
133
      end, true] }
×
134

135
      sequence = {
×
136
        "ws_start" => "main",
×
NEW
137
        "main"     => { abort: :abort, finish: "write", next: "write" },
×
NEW
138
        "write"    => { abort: :abort, next: :next }
×
UNCOV
139
      }
×
140

141
      Wizard.CreateDialog
×
142
      Wizard.SetDesktopTitleAndIcon("org.opensuse.yast.Security")
×
143

144
      # Read has no progress and returns only true
145
      Security.Read
×
146

147
      ret = Sequencer.Run(aliases, sequence)
×
148

149
      UI.CloseDialog
×
150
      deep_copy(ret)
×
151
    end
×
152

153
    # Whole configuration of security but without reading and writing.
154
    # For use with autoinstallation.
155
    # @return [Object] Returned value from WizardSequencer() call
156
    def SecurityAutoSequence
×
157
      # Dialog caption
158
      caption = _("Security Configuration")
×
159
      # Label
160
      contents = Label(_("Initializing..."))
×
161

162
      Wizard.CreateDialog
×
163
      Wizard.SetDesktopTitleAndIcon("org.opensuse.yast.Security")
×
164
      Wizard.SetContentsButtons(
×
165
        caption,
×
166
        contents,
×
167
        "",
×
168
        Label.BackButton,
×
169
        Label.NextButton
×
170
      )
×
171

172
      # Run the main configuration workflow
173
      ret = TreeDialog()
×
174

175
      UI.CloseDialog
×
176
      deep_copy(ret)
×
177
    end
×
178
  end
×
179
end
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc