Module: Yast::SecurityUsersInclude

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) AdduserDialog

Adduser dialog

Returns:

  • dialog result



43
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
97
98
99
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File '../../src/include/security/users.rb', line 43

def AdduserDialog
  # Adduser dialog caption
  caption = _("User Addition")
  help = Ops.get_string(@HELPS, "adduser", "")

  # Adduser dialog contents
  contents = VBox(
    VSeparator(),
    # Frame label
    XFrame(
      1.8,
      0.5,
      _("User ID Limitations"),
      HBox(
        settings2widget("UID_MIN"),
        HSpacing(1.5),
        settings2widget("UID_MAX")
      )
    ),
    VSpacing(0.7),
    # Frame label
    XFrame(
      1.8,
      0.5,
      _("Group ID Limitations"),
      HBox(
        settings2widget("GID_MIN"),
        HSpacing(1.5),
        settings2widget("GID_MAX")
      )
    ),
    VSpacing(1.7)
  )

  contents = HVCenter(
    HVSquash(
      HBox(
        HSpacing(5),
        VBox(VSpacing(2), ReplacePoint(Id(:rp_main), contents), VSpacing(2)),
        HSpacing(5)
      )
    )
  )
  Wizard.SetContentsButtons(
    caption,
    contents,
    help,
    Label.BackButton,
    Label.OKButton
  )

  Wizard.HideBackButton
  Wizard.SetAbortButton(:abort, Label.CancelButton)

  # select the dialog in the tree navigation
  Wizard.SelectTreeItem("users")

  ret = nil
  while true
    ret = UI.UserInput

    # abort?
    if ret == :abort || ret == :cancel
      if ReallyAbort()
        break
      else
        next
      end
    # back
    elsif ret == :back
      break
    # next
    elsif ret == :next || Builtins.contains(@tree_dialogs, ret)
      # the current item has been selected, do not change to the same dialog
      if ret == "users"
        # preselect the item if it has been unselected
        Wizard.SelectTreeItem("users") if Wizard.QueryTreeItem != "users"

        next
      end

      if checkMinMax("UID_MIN", "UID_MAX") != true
        # Popup text
        Popup.Error(
          _("The minimum user ID cannot be larger than the maximum.")
        )
        next
      end
      if checkMinMax("GID_MIN", "GID_MAX") != true
        # Popup text
        Popup.Error(
          _("The minimum group ID cannot be larger than the\nmaximum.")
        )
        next
      end
      break
    else
      Builtins.y2error("Unexpected return code: %1", ret)
      next
    end
  end

  if ret == :next || Builtins.contains(@tree_dialogs, ret)
    widget2settings("GID_MIN")
    widget2settings("GID_MAX")
    widget2settings("UID_MIN")
    widget2settings("UID_MAX")
  end

  deep_copy(ret)
end

- (Object) initialize_security_users(include_target)



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

def initialize_security_users(include_target)
  textdomain "security"

  Yast.import "Label"
  Yast.import "Popup"
  Yast.import "Wizard"

  Yast.include include_target, "security/helps.rb"
  Yast.include include_target, "security/routines.rb"
end