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

yast / yast-security / 4251698580

pending completion
4251698580

push

github

Unknown Committer
Unknown Commit Message

1 of 1 new or added line in 1 file covered. (100.0%)

1375 of 3475 relevant lines covered (39.57%)

5.82 hits per line

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

0.0
/src/include/security/users.rb
1
# encoding: utf-8
2

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

22
# File:        include/security/wizards.ycp
23
# Package:        Security configuration
24
# Summary:        Wizards definitions
25
# Authors:        Michal Svec <msvec@suse.cz>
26
#
27
# $Id$
28
module Yast
×
29
  module SecurityUsersInclude
×
30
    def initialize_security_users(include_target)
×
31
      textdomain "security"
×
32

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

37
      Yast.include include_target, "security/helps.rb"
×
38
      Yast.include include_target, "security/routines.rb"
×
39
    end
×
40

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

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

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

94
      Wizard.HideBackButton
×
95
      Wizard.SetAbortButton(:abort, Label.CancelButton)
×
96

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

100
      ret = nil
×
101
      while true
×
102
        ret = UI.UserInput
×
103

104
        # abort?
105
        if ret == :abort || ret == :cancel
×
106
          if ReallyAbort()
×
107
            break
×
108
          else
×
109
            next
×
110
          end
×
111
        # back
112
        elsif ret == :back
×
113
          break
×
114
        # next
115
        elsif ret == :next || Builtins.contains(@tree_dialogs, ret)
×
116
          # the current item has been selected, do not change to the same dialog
117
          if ret == "users"
×
118
            # preselect the item if it has been unselected
119
            Wizard.SelectTreeItem("users") if Wizard.QueryTreeItem != "users"
×
120

121
            next
×
122
          end
×
123

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

145
      if ret == :next || Builtins.contains(@tree_dialogs, ret)
×
146
        widget2settings("GID_MIN")
×
147
        widget2settings("GID_MAX")
×
148
        widget2settings("UID_MIN")
×
149
        widget2settings("UID_MAX")
×
150
      end
×
151

152
      deep_copy(ret)
×
153
    end
×
154
  end
×
155
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

© 2025 Coveralls, Inc