• 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/users.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 SecurityUsersInclude
×
28
    def initialize_security_users(include_target)
×
29
      textdomain "security"
×
30

31
      Yast.import "Label"
×
32
      Yast.import "Popup"
×
33
      Yast.import "Wizard"
×
34

35
      Yast.include include_target, "security/helps.rb"
×
36
      Yast.include include_target, "security/routines.rb"
×
37
    end
×
38

39
    # Adduser dialog
40
    # @return dialog result
41
    def AdduserDialog
×
42
      # Adduser dialog caption
43
      caption = _("User Addition")
×
44
      help = Ops.get_string(@HELPS, "adduser", "")
×
45

46
      # Adduser dialog contents
47
      contents = VBox(
×
48
        VSeparator(),
×
49
        # Frame label
50
        XFrame(
×
51
          1.8,
×
52
          0.5,
×
53
          _("User ID Limitations"),
×
54
          HBox(
×
55
            settings2widget("UID_MIN"),
×
56
            HSpacing(1.5),
×
57
            settings2widget("UID_MAX")
×
58
          )
×
59
        ),
×
60
        VSpacing(0.7),
×
61
        # Frame label
62
        XFrame(
×
63
          1.8,
×
64
          0.5,
×
65
          _("Group ID Limitations"),
×
66
          HBox(
×
67
            settings2widget("GID_MIN"),
×
68
            HSpacing(1.5),
×
69
            settings2widget("GID_MAX")
×
70
          )
×
71
        ),
×
72
        VSpacing(1.7)
×
73
      )
×
74

75
      contents = HVCenter(
×
76
        HVSquash(
×
77
          HBox(
×
78
            HSpacing(5),
×
79
            VBox(VSpacing(2), ReplacePoint(Id(:rp_main), contents), VSpacing(2)),
×
80
            HSpacing(5)
×
81
          )
×
82
        )
×
83
      )
×
84
      Wizard.SetContentsButtons(
×
85
        caption,
×
86
        contents,
×
87
        help,
×
88
        Label.BackButton,
×
89
        Label.OKButton
×
90
      )
×
91

92
      Wizard.HideBackButton
×
93
      Wizard.SetAbortButton(:abort, Label.CancelButton)
×
94

95
      # select the dialog in the tree navigation
96
      Wizard.SelectTreeItem("users")
×
97

98
      ret = nil
×
NEW
99
      loop do
×
100
        ret = UI.UserInput
×
101

102
        # abort?
NEW
103
        if [:abort, :cancel].include?(ret)
×
NEW
104
          ReallyAbort() ? break : next
×
105
        # back
106
        elsif ret == :back
×
107
          break
×
108
        # next
109
        elsif ret == :next || Builtins.contains(@tree_dialogs, ret)
×
110
          # the current item has been selected, do not change to the same dialog
111
          if ret == "users"
×
112
            # preselect the item if it has been unselected
113
            Wizard.SelectTreeItem("users") if Wizard.QueryTreeItem != "users"
×
114

115
            next
×
116
          end
×
117

118
          if checkMinMax("UID_MIN", "UID_MAX") != true
×
119
            # Popup text
120
            Popup.Error(
×
121
              _("The minimum user ID cannot be larger than the maximum.")
×
122
            )
×
123
            next
×
124
          end
×
125
          if checkMinMax("GID_MIN", "GID_MAX") != true
×
126
            # Popup text
127
            Popup.Error(
×
128
              _("The minimum group ID cannot be larger than the\nmaximum.")
×
129
            )
×
130
            next
×
131
          end
×
132
          break
×
133
        else
×
134
          Builtins.y2error("Unexpected return code: %1", ret)
×
135
          next
×
136
        end
×
137
      end
×
138

139
      if ret == :next || Builtins.contains(@tree_dialogs, ret)
×
140
        widget2settings("GID_MIN")
×
141
        widget2settings("GID_MAX")
×
142
        widget2settings("UID_MIN")
×
143
        widget2settings("UID_MAX")
×
144
      end
×
145

146
      deep_copy(ret)
×
147
    end
×
148
  end
×
149
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