/
widgets.rb
2350 lines (2204 loc) · 70.3 KB
/
widgets.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
154
155
156
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
239
240
241
242
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
277
278
279
280
281
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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# encoding: utf-8
# ------------------------------------------------------------------------------
# Copyright (c) 2006-2012 Novell, Inc. All Rights Reserved.
#
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of version 2 of the GNU General Public License as published by the
# Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, contact Novell, Inc.
#
# To contact Novell about this file by physical or electronic mail, you may find
# current contact information at www.novell.com.
# ------------------------------------------------------------------------------
# File: include/users/widgets.ycp
# Package: Configuration of users and groups
# Summary: Widgets definitions and helper functions
# Authors: Jiri Suchomel <jsuchome@suse.cz>
#
require "shellwords"
module Yast
module UsersWidgetsInclude
def initialize_users_widgets(include_target)
Yast.import "UI"
Yast.import "Autologin"
Yast.import "CWMTab"
Yast.import "Label"
Yast.import "Ldap"
Yast.import "Message"
Yast.import "Mode"
Yast.import "Package"
Yast.import "Popup"
Yast.import "Progress"
Yast.import "Report"
Yast.import "Stage"
Yast.import "String"
Yast.import "Summary"
Yast.import "Users"
Yast.import "UsersCache"
Yast.import "UsersLDAP"
Yast.import "UsersRoutines"
Yast.import "Wizard"
Yast.include include_target, "users/complex.rb"
Yast.include include_target, "users/routines.rb"
Yast.include include_target, "users/ldap_dialogs.rb"
textdomain "users"
# values to MenuItem in Summary dialog
@userset_to_string = {
# the type of user set
"system" => _("&System Users"),
# the type of user set
"local" => _("&Local Users"),
# the type of user set
"nis" => _("&NIS Users"),
# the type of user set
"ldap" => _("L&DAP Users"),
# the type of user set
"samba" => _("Sam&ba Users"),
# the type of user set
"custom" => _("&Custom")
}
# values to Label (no shortcut sign)
@userset_to_label = {
# the type of user set
"system" => _("System Users"),
# the type of user set
"local" => _("Local Users"),
# the type of user set
"nis" => _("NIS Users"),
# the type of user set
"ldap" => _("LDAP Users"),
# the type of user set
"samba" => _("Samba Users"),
# the type of user set
"custom" => _("Custom")
}
# values to MenuItem in Summary dialog
@groupset_to_string = {
# the type of group set
"system" => _("&System Groups"),
# the type of group set
"local" => _("&Local Groups"),
# the type of group set
"nis" => _("&NIS Groups"),
# the type of group set
"ldap" => _("L&DAP Groups"),
# the type of group set
"samba" => _("Sam&ba Groups"),
# the type of group set
"custom" => _("&Custom")
}
@groupset_to_label = {
# the type of group set
"system" => _("System Groups"),
# the type of group set
"local" => _("Local Groups"),
# the type of group set
"nis" => _("NIS Groups"),
# the type of group set
"ldap" => _("LDAP Groups"),
# the type of group set
"samba" => _("Samba Groups"),
# the type of group set
"custom" => _("Custom")
}
# map with group names allowed for a default group
@all_groupnames = {}
# global values for authentication tab: ---------
# list of installed clients
@installed_clients = []
@configurable_clients = ["nis", "sssd", "samba"]
# save if no more Available calls should be done (bug #225484)
@check_available = true
@client_label = {
# richtext label
"nis" => _("NIS"),
# richtext label
"sssd" => _("SSSD"),
# richtext label
"samba" => _("Samba")
}
# auth methods and respective module calls
@auth_methods = {
"nis" => {
# menubutton label
"label" => _("&NIS"),
"package" => "yast2-nis-client",
"call" => "nis-client"
},
"sssd" => {
# menubutton label
"label" => _("&SSSD"),
"package" => "yast2-auth-client",
"call" => "auth-client"
},
"samba" => {
# menubutton label
"label" => _("&Samba"),
"package" => "yast2-samba-client",
"call" => "samba-client"
},
}
@tabs_description = {
"users" => {
# tab header
"header" => _("&Users"),
"contents" => HBox(
HSpacing(0.5),
VBox("filter_line", "tab_switch_users", "table"),
HSpacing(0.5)
),
"widget_names" => ["tab_switch_users", "filter_line", "table"]
},
"groups" => {
# tab header
"header" => _("&Groups"),
"contents" => HBox(
HSpacing(0.5),
VBox("filter_line", "tab_switch_groups", "table"),
HSpacing(0.5)
),
"widget_names" => ["tab_switch_groups", "filter_line", "table"]
},
"defaults" => {
# tab header
"header" => _("De&faults for New Users"),
"contents" => HBox(
HSpacing(2),
VBox(
VStretch(),
VSpacing(0.2),
"defaults_global",
"defaultgroup",
"shell",
HBox("home", VBox(Label(""), "browse_home")),
"umask",
"expire",
"inactive",
VSpacing(0.2),
VStretch()
),
HSpacing(2)
),
"widget_names" => [
"defaults_global",
"defaultgroup",
"shell",
"home",
"browse_home",
"umask",
"expire",
"inactive"
]
},
"authentication" => {
# tab header
"header" => _("&Authentication Settings"),
"contents" => HBox(
HSpacing(),
VBox(VSpacing(0.5), "auth_global", VSpacing(0.5)),
HSpacing()
),
"widget_names" => ["auth_global"]
}
}
@widgets = {
# widgets for "users" and "groups" tabs ---------------------------------
"tab_switch_users" => {
"widget" => :empty,
"init" => fun_ref(method(:InitTabUsersGroups), "void (string)"),
"help" => UsersDialogHelp()
},
"tab_switch_groups" => {
"widget" => :empty,
"init" => fun_ref(method(:InitTabUsersGroups), "void (string)"),
"help" => GroupsDialogHelp()
},
"filter_line" => {
"widget" => :custom,
"custom_widget" => ReplacePoint(
Id(:rpfilter),
HBox(
Left(Label(Id(:current_filter), "")),
Right(
MenuButton(
Id(:sets),
Opt(:key_F2, :disabled),
_("&Set Filter"),
[]
)
)
)
),
"init" => fun_ref(method(:InitFilterLine), "void (string)"),
"handle" => fun_ref(
method(:HandleFilterLine),
"symbol (string, map)"
),
"handle_events" => [
# these are for user/group types
"local",
"system",
"ldap",
"nis",
"custom",
:customize
],
"no_help" => true
},
"table" => {
"widget" => :custom,
"custom_widget" => VBox(
ReplacePoint(Id(:rptable), Table(Id("table"), Header(""))),
HBox(
PushButton(Id(:new), Opt(:key_F3), Label.AddButton),
PushButton(Id(:edit), Opt(:key_F4), Label.EditButton),
PushButton(Id(:delete), Opt(:key_F5), Label.DeleteButton),
HStretch(),
ReplacePoint(
Id(:rpexpert),
# Menu Buton label
MenuButton(Id(:expertlist), _("E&xpert Options"), [])
)
),
VSpacing(0.2)
),
"init" => fun_ref(method(:SummaryTableInit), "void (string)"),
"handle" => fun_ref(
method(:HandleSummaryTable),
"symbol (string, map)"
),
"handle_events" => [
"table",
:new,
:edit,
:delete,
:next,
:enc,
:autologinconf,
:save,
:ldapfilter,
:ldapconf
],
"no_help" => true
},
# widgets for user defaults --------------------------------------------
"defaults_global" => {
"widget" => :empty,
"init" => fun_ref(method(:InitDefaults), "void (string)"),
"store" => fun_ref(method(:StoreDefaults), "void (string, map)"),
"help" => DefaultsDialogHelp()
},
"defaultgroup" => {
"widget" => :combobox,
"opt" => [:hstretch],
# combobox label
"label" => _("D&efault Group"),
"no_help" => true
},
"shell" => {
"widget" => :combobox,
"opt" => [:hstretch, :editable],
# combobox label
"label" => _("Default &Login Shell"),
"no_help" => true,
"validate_type" => :function,
"validate_function" => fun_ref(
method(:ValidateShell),
"boolean (string, map)"
)
},
"home" => {
"widget" => :textentry,
# text entry
"label" => _(
"Path Prefix for &Home Directory"
),
"no_help" => true,
"validate_type" => :function,
"validate_function" => fun_ref(
method(:ValidateHomePrefix),
"boolean (string, map)"
)
},
"browse_home" => {
"widget" => :push_button,
# push button label
"label" => _("&Browse..."),
"opt" => [:key_F6],
"handle" => fun_ref(
method(:HandleBrowseDirectory),
"symbol (string, map)"
),
"no_help" => true
},
"expire" => {
"widget" => :textentry,
# text entry
"label" => _("Default E&xpiration Date"),
"no_help" => true,
"validate_type" => :function,
"validate_function" => fun_ref(
method(:ValidateExpire),
"boolean (string, map)"
)
},
"umask" => {
"widget" => :textentry,
"valid_chars" => "01234567",
# text entry
"label" => _("&Umask for Home Directory"),
"no_help" => true
},
"inactive" => {
"widget" => :intfield,
"opt" => [:hstretch],
# intfield
"label" => _(
"Days &after Password Expiration Login Is Usable"
),
"minimum" => -1,
"no_help" => true
},
# widgets for authentication settings tab ------------------------------
"auth_global" => {
"widget" => :custom,
"help" => AuthentizationDialogHelp(),
"init" => fun_ref(method(:InitAuthData), "void (string)"),
"store" => fun_ref(
method(:StoreAuthData),
"void (string, map)"
),
"handle" => fun_ref(
method(:HandleAuthData),
"symbol (string, map)"
),
"custom_widget" => VBox(
RichText(Id("auth_summary"), ""),
VSpacing(0.5),
ReplacePoint(
Id(:rpbutton),
# menu button label
MenuButton(Opt(:key_F4), _("&Configure..."), [])
)
),
"handle_events" => ["sssd", "nis", "samba"]
}
}
end
# Popup for choosing the password encryption method.
#
def EncryptionPopup
method = Users.EncryptionMethod
# Help text for password expert dialog 1/5
help_text = _(
"<p>\n" +
"<b>This is for experts only.</b>\n" +
"</p>"
)
# Help text for password expert dialog 2/5
help_text = Ops.add(
help_text,
_(
"<p>\n" +
"Choose a password encryption method for local and system users.\n" +
"<b>DES</b>, the Linux default method, works in all network environments, but it\n" +
"restricts passwords to eight characters or less.\n" +
"</p>\n"
)
)
# Help text for password expert dialog 3/5
help_text = Ops.add(
help_text,
_(
"<p>\n" +
"<b>MD5</b> allows longer passwords, so provides more security, but some\n" +
"network protocols do not support this and you may have problems with NIS.\n" +
"</p>"
)
)
# Help text for password expert dialog 4/5
help_text = Ops.add(
help_text,
_(
"<p><b>SHA-512</b> is the current standard hash method. Using other algorithms is not recommended unless needed for compatibility purposes.</p>"
)
)
UI.OpenDialog(
VBox(
# Label
Heading(_("Password Encryption")),
VSpacing(0.7),
HBox(
HSpacing(2),
# frame label
RadioButtonGroup(
Id(:methods),
Frame(
_("Encryption Type"),
HBox(
HSpacing(),
VBox(
VSpacing(0.5),
# Radio buttons for password encryption: DES-crypt
Left(RadioButton(Id("des"), _("&DES"), method == "des")),
# Radio buttons for password encryption: MD5-crypt
Left(RadioButton(Id("md5"), _("&MD5"), method == "md5")),
# Radio buttons for password encryption: sha256 crypt
Left(
RadioButton(
Id("sha256"),
_("SHA-&256"),
method == "sha256"
)
),
# Radio buttons for password encryption: sha512 crypt
Left(
RadioButton(
Id("sha512"),
_("SHA-&512"),
method == "sha512"
)
),
VSpacing(0.5)
)
)
)
),
HSpacing(2)
),
VSpacing(0.5),
HBox(
HStretch(),
HWeight(
1,
PushButton(Id(:ok), Opt(:default, :key_F10), Label.OKButton)
),
HStretch(),
HWeight(
1,
PushButton(Id(:cancel), Opt(:key_F9), Label.CancelButton)
),
HStretch(),
HWeight(1, PushButton(Id(:help), Opt(:key_F2), Label.HelpButton)),
HStretch()
)
)
)
button = nil
begin
button = UI.UserInput
if button == :help
Wizard.ShowHelp(help_text)
elsif button == :ok
method = Convert.to_string(
UI.QueryWidget(Id(:methods), :CurrentButton)
)
Builtins.y2milestone("Changing encryption method to %1", method)
end
end while button != :ok && button != :cancel
UI.CloseDialog
method
end
# NIS server enabled together with non-DES encryption of passwords
# In these popup, ask user what to do.
def AskForNISServerEncryptionPopup(encr)
ret = :ok
# help text 1/3
text = _(
"<p>\nYou have changed the default encryption for user passwords.</p>"
) +
# help text 2/3
_(
"<p>It seems that you are running a NIS server. In some network environments,\n" +
"you might be unable to log in to a NIS client when a user password is\n" +
"encrypted with a method other than DES.\n" +
"</p>\n"
) +
# help text 3/3
_("<p>Really use the selected method?</p>")
UI.OpenDialog(
Opt(:decorated),
HBox(
VSpacing(14),
VBox(
HSpacing(50),
RichText(Id(:rt), text),
CheckBox(Id(:ch), Opt(:notify), Message.DoNotShowMessageAgain),
HBox(
PushButton(Id(:ok), Opt(:key_F10), Label.YesButton),
PushButton(Id(:no), Opt(:key_F9), Label.NoButton)
)
)
)
)
begin
ret = Convert.to_symbol(UI.UserInput)
end while !Builtins.contains([:cancel, :ok, :no], ret)
if ret != :cancel
Users.SetAskNISServerNotDES(
Convert.to_boolean(UI.QueryWidget(Id(:ch), :Value))
)
end
UI.CloseDialog
ret
end
# Popup for configuration user/group filter for making the LDAP search
# @return modified?
def LDAPSearchFilterPopup
default_user_f = UsersLDAP.GetDefaultUserFilter
default_group_f = UsersLDAP.GetDefaultGroupFilter
user_f = UsersLDAP.GetCurrentUserFilter
group_f = UsersLDAP.GetCurrentGroupFilter
user_f = default_user_f if user_f == ""
group_f = default_group_f if group_f == ""
ret = false
# attributes are listed here, because during filter editing, the connection
# to LDAP server doesn't have to be run yet
user_attributes = [
"objectClass",
"loginShell",
"gecos",
"description",
"cn",
"uid",
"uidNumber",
"gidNumber",
"homeDirectory",
"shadowLastChange",
"shadowMin",
"shadowMax",
"shadowWarning",
"shadowInactive",
"shadowExpire",
"shadowFlag",
"audio",
"businessCategory",
"carLicense",
"departmentNumber",
"displayName",
"employeeNumber",
"employeeType",
"givenName",
"homePhone",
"homePostalAddress",
"initials",
"jpegPhoto",
"labeledUri",
"mail",
"manager",
"mobile",
"o",
"pager",
"photo",
"roomNumber",
"secretary",
"userCertificate",
"x500uniqueIdentifier",
"preferredLanguage",
"userSMIMECertificate",
"userPKCS12",
"title",
"x121Address",
"registeredAddress",
"destinationIndicator",
"preferredDeliveryMethod",
"telexNumber",
"teletexTerminalIdentifier",
"telephoneNumber",
"internationalISDNNumber",
"facsimileTelephoneNumber",
"street",
"postOfficeBox",
"postalCode",
"postalAddress",
"physicalDeliveryOfficeName",
"ou",
"st",
"l",
"seeAlso",
"sn"
]
group_attributes = [
"objectClass",
"memberUid",
"description",
"gidNumber",
"businessCategory",
"seeAlso",
"owner",
"ou",
"o",
"member",
"cn"
]
connectives = [
# combo box item
Item(Id("and"), _("AND")),
# combo box item
Item(Id("or"), _("OR"))
]
equality = ["=", "~=", "<=", ">="]
curr_shown = UsersCache.GetCurrentSummary == "users" ? :users : :groups
help_text =
# helptext 1/4 - caption
_("<p><b>LDAP Search Filter Changes</b></p>") +
# helptext 2/4
_(
"<p>Here, extend the search filters for users and groups beyond the default search filters.</p>"
) +
# helptext 3/4
_(
"<p>With <b>Default</b>, load the default filter from the user and group\n" +
"configuration modules saved on the LDAP server (values of 'suseSearchFilter' attributes).\n" +
"If you are not connected yet, you are prompted for the password.</p>\n"
) +
# helptext 4/4 (do not translate the value (written as <tt> font))
_(
"<p><b>Example:</b>\n" +
"<br>With the user filter\n" +
"<br>\n" +
"<tt>(&(objectClass=posixAccount)(uid=u*))</tt>\n" +
"<br>\n" +
"only obtain users with a username beginning with 'u'.</p>\n"
)
contents = HBox(
HSpacing(1.5),
VBox(
HSpacing(70), # max 65 with help on left side...
VSpacing(0.5),
Left(
RadioButtonGroup(
VBox(
Left(
RadioButton(
Id(:users),
Opt(:notify),
# radiobutton label
_("Search Filter for &Users"),
curr_shown == :users
)
),
Left(
RadioButton(
Id(:groups),
Opt(:notify),
# radiobutton label
_("Search Filter for &Groups"),
curr_shown == :groups
)
)
)
)
),
TextEntry(Id(:currf), "", curr_shown == :users ? user_f : group_f),
VSpacing(0.5),
# frame label
Frame(
_("New Condition for Current Filter"),
HBox(
HSpacing(0.5),
VBox(
Left(ComboBox(Id(:andor), "", connectives)),
HBox(
ReplacePoint(
Id(:rpa),
# combobox label
ComboBox(
Id(:atrs),
Opt(:editable),
_("&Attribute"),
curr_shown == :users ? user_attributes : group_attributes
)
),
HSpacing(),
VBox(Label(""), ComboBox(Id(:eq), "", equality)),
HSpacing(),
# textentry label
TextEntry(Id(:val), _("&Value"), "")
),
# pushbuttton label
Right(PushButton(Id(:addu), _("A&dd to Filter")))
),
HSpacing(0.5)
)
),
VSpacing(),
HBox(
PushButton(Id(:ok), Opt(:default, :key_F10), Label.OKButton),
PushButton(Id(:cancel), Opt(:key_F9), Label.CancelButton),
PushButton(Id(:help), Opt(:key_F2), Label.HelpButton),
# Pushbutton label
PushButton(Id(:read), Opt(:key_F3), _("De&fault"))
),
VSpacing(0.5)
),
HSpacing(1.5)
)
UI.OpenDialog(Opt(:decorated), contents)
button = :notnext
begin
button = Convert.to_symbol(UI.UserInput)
if button == :help
Wizard.ShowHelp(help_text)
next
end
if button == :read
if Ldap.bind_pass == nil
Ldap.SetBindPassword(Ldap.GetLDAPPassword(true))
end
if Ldap.bind_pass != nil && UsersLDAP.ReadFilters == ""
UI.ChangeWidget(
Id(:currf),
:Value,
curr_shown == :users ?
UsersLDAP.GetDefaultUserFilter :
UsersLDAP.GetDefaultGroupFilter
)
end
next
end
curr_f = Convert.to_string(UI.QueryWidget(Id(:currf), :Value))
if button == :addu
if Convert.to_string(UI.QueryWidget(Id(:val), :Value)) == ""
# error popup
Popup.Error(_("Enter the value for the attribute."))
UI.SetFocus(Id(:val))
next
end
new_value = Builtins.sformat(
"%1%2%3",
Convert.to_string(UI.QueryWidget(Id(:atrs), :Value)),
Convert.to_string(UI.QueryWidget(Id(:eq), :Value)),
Convert.to_string(UI.QueryWidget(Id(:val), :Value))
)
conn = Convert.to_string(UI.QueryWidget(Id(:andor), :Value))
UI.ChangeWidget(
Id(:currf),
:Value,
UsersLDAP.AddToFilter(curr_f, new_value, conn)
)
end
if button == :ok || button == :users || button == :groups
if (button == :groups || button == :ok && curr_shown == :users) &&
user_f != curr_f
curr_user_f = curr_f
if curr_user_f == ""
# error popup
Popup.Error(_("Enter the value of the user filter."))
UI.SetFocus(Id(:currf))
button = :notnext
next
end
if !Builtins.issubstring(
Builtins.tolower(curr_user_f),
Builtins.tolower(default_user_f)
) &&
# yes/no popup question
!Popup.YesNo(
_(
"The new user filter does not contain the default user filter.\nReally use it?\n"
)
)
UI.SetFocus(Id(:currf))
button = :notnext
next
end
user_f = curr_user_f
end
if (button == :users || button == :ok && curr_shown == :groups) &&
group_f != curr_f
curr_group_f = curr_f
if curr_group_f == ""
# error popup
Popup.Error(_("Enter the value of the group filter."))
UI.SetFocus(Id(:currf))
button = :notnext
next
end
if !Builtins.issubstring(
Builtins.tolower(curr_group_f),
Builtins.tolower(default_group_f)
)
# yes/no popup question
if !Popup.YesNo(
_(
"The new group filter does not contain the default group filter.\nReally use it?\n"
)
)
UI.SetFocus(Id(:currf))
button = :notnext
next
end
end
group_f = curr_group_f
end
if button == :ok
# checks are OK, let's update the values now
if user_f != UsersLDAP.GetCurrentUserFilter
UsersLDAP.SetCurrentUserFilter(user_f)
ret = true
end
if group_f != UsersLDAP.GetCurrentGroupFilter
UsersLDAP.SetCurrentGroupFilter(group_f)
ret = true
end
else
UI.ChangeWidget(Id(curr_shown), :Value, false)
curr_shown = curr_shown == :users ? :groups : :users
UI.ChangeWidget(Id(curr_shown), :Value, true)
UI.ChangeWidget(
Id(:currf),
:Value,
curr_shown == :users ? user_f : group_f
)
UI.ReplaceWidget(
Id(:rpa),
# combobox label
ComboBox(
Id(:atrs),
Opt(:editable),
_("&Attribute"),
curr_shown == :users ? user_attributes : group_attributes
)
)
end
end
end while button != :ok && button != :cancel
UI.CloseDialog
ret
end
# Popup for Login settings (Auotolgin feature, login without passwords)
# @return modified?
#
def AutologinPopup
help_text =
# helptext 0/3 - caption
_("<p><b>Login Settings</b></p>") +
# helptext 1/3 - general info
_(
"<p>\n" +
"The features described below are only available if you are using KDM or GDM as the login manager.\n" +
"</p>\n"
) +
# helptext 2/3
_(
"<p><b>Auto Login</b><br>\nBy setting <b>Auto Login</b>, skip the login procedure. The user chosen from the list is logged in automatically.</p>\n"
) +
# helptext 3/3
_(
"<p><b>Passwordless Logins</b><br>\n" +
"If this option is checked, all users are allowed to log in without entering\n" +
"passwords. Otherwise, you are asked for the password even if you set a user to log in automatically.</p>\n"
)
ret = false
user = Autologin.user
pw_less = Autologin.pw_less
auto_used = user != ""
# TODO check if nis/ldap users were read?
usernames = UsersCache.GetUsernames("local")
UI.OpenDialog(
Opt(:decorated),
HBox(
HSpacing(1.5),
VBox(
HSpacing(40),
VSpacing(0.5),
# dialog label
Heading(_("Display Manager Login Settings")),
HBox(
HSpacing(0.5),
VBox(
VSpacing(0.5),
Left(
CheckBox(
Id(:auto),
Opt(:notify),
# checkbox label
_("&Auto Login"),
auto_used
)
),
VSpacing(0.2),
HBox(
HSpacing(4), # move text under the checkbox
Left(
ComboBox(
Id(:autouser),
# textentry label
_("&User to Log In"),
usernames
)
)
),
VSpacing(0.5),
Left(
CheckBox(
Id(:pw_less),
# checkbox label
_("Password&less Logins"),
pw_less