Module: Yast::UsersWizardsInclude

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) AutoSequence(start)

Whole configuration of users/groups but without reading and writing. For use with autoinstallation.

Parameters:

  • start (String)

    the first dialog

Returns:

  • sequence result



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# File '../../src/include/users/wizards.rb', line 282

def AutoSequence(start)
  # dialog caption
  caption = _("User and Group Configuration")

  # label (during init dialog)
  contents = Label(_("Initializing..."))

  Wizard.CreateDialog
  Wizard.SetDesktopIcon("users")
  Wizard.SetContentsButtons(
    caption,
    contents,
    "",
    Label.BackButton,
    Label.NextButton
  )

  # initialization: ---------------- (simulate empty Import: bug #44660)
  Users.Initialize if Mode.config && !Users.Modified
  # --------------------------------

  ret = MainSequence(start)

  UI.CloseDialog
  ret
end

- (Object) initialize_users_wizards(include_target)



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File '../../src/include/users/wizards.rb', line 31

def initialize_users_wizards(include_target)
  Yast.import "UI"

  textdomain "users"

  Yast.import "CWM"
  Yast.import "CWMTab"
  Yast.import "Label"
  Yast.import "Ldap"
  Yast.import "Mode"
  Yast.import "Popup"
  Yast.import "Sequencer"
  Yast.import "Stage"
  Yast.import "UsersCache"
  Yast.import "Users"
  Yast.import "Wizard"

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

- (Object) InitializeTableItems

Before showing the table for first time, read LDAP/NIS if they are included in custom set



66
67
68
69
70
71
72
73
74
75
76
77
# File '../../src/include/users/wizards.rb', line 66

def InitializeTableItems
  if UsersCache.CustomizedUsersView || UsersCache.CustomizedGroupsView
    if (Builtins.contains(Users.GetUserCustomSets, "ldap") ||
        Builtins.contains(Users.GetGroupCustomSets, "ldap")) &&
        Ldap.bind_pass == nil
      Ldap.SetBindPassword(Ldap.GetLDAPPassword(true))
    end
    Users.ChangeCurrentUsers("custom") if UsersCache.CustomizedUsersView
    Users.ChangeCurrentGroups("custom") if UsersCache.CustomizedGroupsView
  end
  :next
end

- (Object) MainSequence(start)

Main workflow of the users/groups configuration

Parameters:

  • start (String)

    the first dialog

Returns:

  • sequence result



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File '../../src/include/users/wizards.rb', line 157

def MainSequence(start)
  aliases = {
    "init_summary"    => [lambda { InitializeTableItems() }, true],
    "summary"         => lambda { SummaryDialog() },
    "user_add"        => lambda { EditUserDialog("add_user") },
    "user_add_inst"   => lambda { EditUserDialog("add_user") },
    "user_inst_start" => [lambda { usersInstStart }, true],
    "user_edit"       => lambda { EditUserDialog("edit_user") },
    "user_save"       => [lambda { UserSave() }, true],
    "group_add"       => lambda { EditGroupDialog("add_group") },
    "group_edit"      => lambda { EditGroupDialog("edit_group") },
    "group_save"      => [lambda { GroupSave() }, true],
    "without_save"    => lambda { ReallyAbort() }
  }

  main_sequence = {
    "ws_start"        => "init_summary",
    "init_summary"    => { :next => start },
    "summary"         => {
      :new_user     => "user_add",
      :edit_user    => "user_edit",
      :delete_user  => "user_save",
      :new_group    => "group_add",
      :edit_group   => "group_edit",
      :delete_group => "group_save",
      :abort        => "without_save",
      :cancel       => "without_save",
      :next         => :next,
      :ok           => :next,
      :nosave       => :nosave,
      :exit         => :abort,
      :summary      => "summary"
    },
    "user_add"        => {
      :nextmodule => :next,
      :nosave     => "summary",
      :additional => "user_save",
      # only install
      :next       => "user_save",
      # -> Commit
      :abort      => :abort,
      :cancel     => :abort
    },
    "user_add_inst"   => {
      :nextmodule => :next,
      # no user and next pressed (install)
      :nosave     => "summary",
      :additional => "user_save",
      :next       => "user_save",
      :abort      => "without_save",
      :cancel     => "without_save"
    },
    "user_edit"       => {
      :next   => "user_save",
      :abort  => :abort,
      :cancel => :abort
    },
    "user_inst_start" => { :next => "user_add_inst" },
    "user_save" =>
      #this should be write - during install??
      { :next => "summary", :save => :next },
    "group_add"       => {
      :nosave => "summary",
      :next   => "group_save",
      :abort  => :abort,
      :cancel => :abort
    },
    "group_edit"      => {
      :next   => "group_save",
      :abort  => :abort,
      :cancel => :abort
    },
    "group_save"      => { :next => "summary" },
    "without_save"    => {
      :next  => :next,
      :abort => :abort,
      :back  => :back
    }
  }

  Sequencer.Run(aliases, main_sequence)
end

- (Object) ReallyBack

—————— CWM —————————————————



56
57
58
59
60
61
62
# File '../../src/include/users/wizards.rb', line 56

def ReallyBack
  if !Stage.cont && Users.Modified
    return Popup.ReallyAbort(Users.Modified)
  else
    return true
  end
end

- (Object) SummaryDialog

run the main (Summary) dialog via CWM



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
# File '../../src/include/users/wizards.rb', line 80

def SummaryDialog
  Ops.set(
    @widgets,
    "tab_users_groups",
    CWMTab.CreateWidget(
      {
        "tab_order"    => ["users", "groups", "defaults", "authentication"],
        "tabs"         => @tabs_description,
        "widget_descr" => @widgets,
        "initial_tab"  => UsersCache.GetCurrentSummary
      }
    )
  )

  contents = VBox("tab_users_groups")

  ret = CWM.ShowAndRun(
    {
      "widget_names"       => ["tab_users_groups"],
      "widget_descr"       => @widgets,
      "contents"           => contents,
      # dialog caption
      "caption"            => _(
        "User and Group Administration"
      ),
      "back_button"        => Stage.cont ? Label.BackButton : "",
      "next_button"        => Stage.cont ? Label.NextButton : Label.OKButton,
      "abort_button"       => Stage.cont ? Label.AbortButton : Label.CancelButton,
      "fallback_functions" => {
        :back => fun_ref(method(:ReallyBack), "boolean ()")
      }
    }
  )
  if ret != nil && Ops.is_symbol?(ret) &&
      Builtins.contains([:new, :edit, :delete], Convert.to_symbol(ret))
    update_symbol = {
      :new    => { "users" => :new_user, "groups" => :new_group },
      :edit   => { "users" => :edit_user, "groups" => :edit_group },
      :delete => { "users" => :delete_user, "groups" => :delete_group }
    }
    ret = Ops.get_symbol(
      update_symbol,
      [ret, UsersCache.GetCurrentSummary],
      :back
    )
  end

  if Stage.cont && (ret == :back || ret == :abort)
    Users.SetStartDialog("user_add")
    Users.SetUseNextTime(true)
    old_gui = Users.GetGUI
    Users.SetGUI(false)
    Users.Read
    # read also LDAP again: bug #41299
    current_users = Users.GetCurrentUsers
    if Builtins.contains(current_users, "ldap")
      Users.SetLDAPNotRead(true)
      Users.ChangeCurrentUsers("ldap")
    else
      # update the user item list
      Users.ChangeCurrentUsers("custom")
    end
    Users.SetGUI(old_gui)
    ret = :back
  end

  Convert.to_symbol(ret)
end

- (Object) UsersSequence(start)

Whole configuration of users/groups

Parameters:

  • start (String)

    the first dialog

Returns:

  • sequence result



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
# File '../../src/include/users/wizards.rb', line 243

def UsersSequence(start)
  aliases = {
    "read"  => [lambda { ReadDialog(!Stage.cont) }, true],
    "main"  => lambda { MainSequence(start) },
    "write" => [lambda { WriteDialog(true) }, true]
  } # true as parameter ??

  sequence = {
    "ws_start" => "read",
    "read" =>
      # this is for skiping users conf during install,
      # see Users::CheckHomeMounted() or bug #20365
      { :abort => :abort, :next => "main", :nextmodule => :next },
    "main"     => { :abort => :abort, :next => "write", :nosave => :next },
    "write"    => { :abort => :abort, :next => :next }
  }

  # init dialog caption
  caption = _("User and Group Configuration")
  # label (during init dialog)
  contents = Label(_("Initializing..."))

  Wizard.OpenNextBackDialog if !Stage.cont
  Wizard.SetDesktopIcon("users")

  ret = Sequencer.Run(aliases, sequence)

  UI.CloseDialog if !Stage.cont

  # read LDAP again in the next run
  Users.SetLDAPNotRead(true)

  Convert.to_symbol(ret)
end