Module: Yast::UsersWidgetsInclude
- Defined in:
- ../../src/include/users/widgets.rb
Instance Method Summary (collapse)
-
- (Object) AskForNISServerEncryptionPopup(encr)
NIS server enabled together with non-DES encryption of passwords In these popup, ask user what to do.
-
- (Object) AutologinPopup
Popup for Login settings (Auotolgin feature, login without passwords).
-
- (Object) ChooseTypePopup(sets, what)
When there are more users/groups shown, choose which type should be created after `add click.
-
- (Object) CustomizePopup(what)
Dialog for definition of customized view.
-
- (Symbol) DeleteGroupPopup
Popup for deleting group.
-
- (Symbol) DeleteUserPopup
Popup for deleting user.
-
- (Object) EncryptionPopup
Popup for choosing the password encryption method.
-
- (Object) get_module_data(client)
helper function to get information about authentication from appropriate module.
-
- (Object) GetExpertList
return the list of menu items of “Expert Options” menubutton.
-
- (Object) GetLDAPExpertList
return the list of menu items for LDAP expert options.
-
- (Object) GetSetsItems(set)
================================================================.
-
- (String) GroupsDialogHelp
Help for usersGroups.
-
- (Object) HandleAuthData(key, event)
Handler for actions in Authentication tab.
-
- (Object) HandleBrowseDirectory(key, event)
universal handler for directory browsing.
- - (Object) HandleFilterLine(widget_id, event)
-
- (Object) HandleSummaryTable(widget_id, event)
Handler for users/groups summary table.
-
- (String) help_main_end
Last part of the help text.
-
- (String) help_main_start
First part of the help text.
-
- (Object) InitAuthData(key)
Init the widgets in Authentication tab.
-
- (Object) InitDefaults(key)
Initialize all the values in the dialog with new user defaults.
-
- (Object) InitFilterLine(widget_id)
Initialize the value of the label with current filter and filter selection.
- - (Object) initialize_users_widgets(include_target)
-
- (Object) InitTabUsersGroups(widget_id)
Handle the switch between tabs (load set of items for users or groups).
-
- (Object) LDAPSearchFilterPopup
Popup for configuration user/group filter for making the LDAP search.
-
- (Object) reload_config(clients)
Reloads the configuration for given client and creates updated summary widget contents returns the summary value for richtext.
-
- (Object) StoreAuthData(key, event)
Actions done when Authentication tab is left.
-
- (Object) StoreDefaults(key, event)
Store all the values from the dialog with new user defaults (when leaving the dialog).
-
- (Object) SummaryTableInit(widget_id)
Initialize the contents of Summary Table widget.
-
- (String) UsersDialogHelp
Help for UsersDialog.
-
- (Object) ValidateExpire(key, event)
Validation function for the default value of account expiration.
-
- (Object) ValidateGroupList(key, event)
Validation function for the value of the default list of groups.
-
- (Object) ValidateHomePrefix(key, event)
Validation function for the default home prefix.
-
- (Object) ValidateShell(key, event)
Validation function for the default login shell.
-
- (Object) ValidateSkeleton(key, event)
Validation function for home directory skeleton directory.
Instance Method Details
- (Object) AskForNISServerEncryptionPopup(encr)
NIS server enabled together with non-DES encryption of passwords In these popup, ask user what to do.
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 |
# File '../../src/include/users/widgets.rb', line 562 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 |
- (Object) AutologinPopup
Popup for Login settings (Auotolgin feature, login without passwords)
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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 |
# File '../../src/include/users/widgets.rb', line 948 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 ) ), VSpacing(0.5) ), HSpacing(0.5) ), VSpacing(0.5), 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) ), VSpacing(0.5) ), HSpacing(1.5) ) ) UI.ChangeWidget(Id(:autouser), :Value, user) if user != "" UI.ChangeWidget(Id(:autouser), :Enabled, auto_used) = nil begin = Convert.to_symbol(UI.UserInput) Wizard.ShowHelp(help_text) if == :help if == :auto auto_used = Convert.to_boolean(UI.QueryWidget(Id(:auto), :Value)) UI.ChangeWidget(Id(:autouser), :Enabled, auto_used) end end while !Builtins.contains([:ok, :cancel, :abort], ) if == :ok user = auto_used ? Convert.to_string(UI.QueryWidget(Id(:autouser), :Value)) : "" pw_less = Convert.to_boolean(UI.QueryWidget(Id(:pw_less), :Value)) if user != Autologin.user || pw_less != Autologin.pw_less ret = true Autologin.used = auto_used Autologin.user = user Autologin.pw_less = pw_less Autologin.modified = true end end UI.CloseDialog ret end |
- (Object) ChooseTypePopup(sets, what)
When there are more users/groups shown, choose which type should be created after `add click
1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 |
# File '../../src/include/users/widgets.rb', line 1344 def ChooseTypePopup(sets, what) sets = deep_copy(sets) set_to_string = { # type of user/group # (item of list with the headline 'Choose the type of user to add') "local" => _( "Local" ), # type of user/group # (item of list with the headline 'Choose the type of user to add') "ldap" => _( "LDAP" ), # type of user/group # (item of list with the headline 'Choose the type of user to add') "system" => _( "System" ) } sets = Builtins.filter(sets) { |set| set != "nis" } ret = Ops.get(sets, 0, "local") label = what == "user" ? # label _("User Type") : # label _("Group Type") return ret if Ops.less_than(Builtins.size(sets), 2) rbs = VBox() Builtins.foreach(sets) do |set| rbs = Builtins.add( rbs, Left( RadioButton( Id(set), Ops.get_string(set_to_string, set, set), set == ret ) ) ) end UI.OpenDialog( Opt(:decorated), HBox( HSpacing(1.5), VBox( HSpacing(40), VSpacing(0.5), Left(Label(label)), VSpacing(0.5), Left(RadioButtonGroup(rbs)), VSpacing(0.5), HBox( PushButton(Id(:ok), Opt(:default, :key_F10), Label.OKButton), PushButton(Id(:cancel), Opt(:key_F9), Label.CancelButton) ), VSpacing(0.5) ), HSpacing(1.5) ) ) r = UI.UserInput Builtins.foreach(sets) do |set| ret = set if Convert.to_boolean(UI.QueryWidget(Id(set), :Value)) end UI.CloseDialog return "" if r == :cancel ret end |
- (Object) CustomizePopup(what)
Dialog for definition of customized view
1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 |
# File '../../src/include/users/widgets.rb', line 1255 def CustomizePopup(what) view = VBox() label = "" sets = [] custom_sets = [] set_to_string = {} if what == "users" sets = Builtins.filter(Users.GetAvailableUserSets) do |set| set != "custom" end custom_sets = Users.GetUserCustomSets set_to_string = deep_copy(@userset_to_string) # Frame label label = _("User List View") else sets = Builtins.filter(Users.GetAvailableGroupSets) do |set| set != "custom" end custom_sets = Users.GetGroupCustomSets set_to_string = deep_copy(@groupset_to_string) # Frame label label = _("Group List View") end Builtins.foreach(sets) do |set| view = Builtins.add(view, VSpacing(0.5)) if Builtins.contains(custom_sets, set) view = Builtins.add( view, Left( CheckBox(Id(set), Ops.get_string(set_to_string, set, ""), true) ) ) else view = Builtins.add( view, Left( CheckBox(Id(set), Ops.get_string(set_to_string, set, ""), false) ) ) end end view = Builtins.add(view, VSpacing(0.5)) UI.OpenDialog( Opt(:decorated), HBox( HSpacing(1.5), VBox( HSpacing(40), VSpacing(0.5), Frame(label, view), VSpacing(0.5), HBox( PushButton(Id(:ok), Opt(:default, :key_F10), Label.OKButton), PushButton(Id(:cancel), Opt(:key_F9), Label.CancelButton) ), VSpacing(0.5) ), HSpacing(1.5) ) ) ret = UI.UserInput modified = false new_customs = [] Builtins.foreach(sets) do |set| if Convert.to_boolean(UI.QueryWidget(Id(set), :Value)) new_customs = Builtins.add(new_customs, set) modified = true if !Builtins.contains(custom_sets, set) else modified = true if Builtins.contains(custom_sets, set) end end if ret == :ok UI.CloseDialog if modified if Builtins.contains(new_customs, "ldap") && Ldap.bind_pass == nil Ldap.SetBindPassword(Ldap.GetLDAPPassword(true)) if Ldap.bind_pass == nil || UsersLDAP.ReadSettings != "" new_customs = Builtins.filter(new_customs) { |set| set != "ldap" } end end modified = Users.ChangeCustoms(what, new_customs) end modified end |
- (Symbol) DeleteGroupPopup
Popup for deleting group
1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 |
# File '../../src/include/users/widgets.rb', line 1205 def DeleteGroupPopup delete = true type = UsersCache.GetGroupType group = Users.GetCurrentGroup member_attribute = UsersLDAP.GetMemberAttribute # if no user is in this group if Ops.get_map(group, "userlist", {}) == {} && Ops.get_map(group, "more_users", {}) == {} && Ops.get_map(group, member_attribute, {}) == {} #if the group is a system group ask the user .. if type == "system" # yes-no popup headline if !Popup.YesNoHeadline( _("System Group"), #/ yes-no popup contents _("Really delete this system group?") ) return nil end else # yes-no popup, %1 si group name if !Popup.YesNo( Builtins.sformat( _("\nReally delete the group %1?\n"), Ops.get_string(group, "cn", "") ) ) return nil end end else # warning popup Popup.Warning( _( "You cannot delete this group because\n" + "there are users in the group.\n" + "Remove these users from the group first.\n" ) ) return nil end Users.DeleteGroup :delete end |
- (Symbol) DeleteUserPopup
Popup for deleting user
1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 |
# File '../../src/include/users/widgets.rb', line 1074 def DeleteUserPopup delete = true delete_home = false type = UsersCache.GetUserType user = Users.GetCurrentUser username = Ops.get_string(user, "uid", "") home = Ops.get_string( user, ["org_user", "homeDirectory"], Ops.get_string( user, "org_homeDirectory", Ops.get_string(user, "homeDirectory", "") ) ) uid = -1 uid_a = Ops.get_string( user, ["org_user", "uidNumber"], Ops.get_string( user, "org_uidNumber", Ops.get_string(user, "uidNumber", "-1") ) ) if Ops.is_string?(uid_a) uid = Builtins.tointeger(uid_a) else uid = Convert.to_integer(uid_a) end if type == "nis" # error popup Report.Message( Builtins.sformat( _("Cannot delete the user %1. It must be done on the NIS server."), username ) ) return nil end if UserLogged(username) # error popup Report.Error( _( "You cannot delete this user, because the user is\n" + "currently logged in.\n" + "Log the user out first." ) ) delete = false return nil end no_home = false # check if dir exists with this owner stat = Convert.to_map(SCR.Read(path(".target.stat"), home)) crypted_img = UsersRoutines.CryptedImagePath(username) if crypted_img != "" # check crypted dir image stat = Convert.to_map(SCR.Read(path(".target.stat"), crypted_img)) end if type == "ldap" && !Ldap.file_server || Ops.get_integer(stat, "uid", -1) != uid no_home = true end # if the user want to delete a system user if type == "system" # yes-no popup headline if !Popup.YesNoHeadline( _("Selected User Is System User"), # yes-no popup contents _("Really delete this system user?") ) delete = false end else if home != "" && !no_home contents = HBox( HSpacing(3), VBox( VSpacing(1), Left( # question popup. %1 is username Heading(Builtins.sformat(_("Delete the user %1?"), username)) ), VSpacing(0.5), Left( CheckBox( Id(:delete_home), # checkbox label Builtins.sformat(_("Delete &Home Directory\n%1\n"), home) ) ), VSpacing(1), HBox( Bottom(PushButton(Id(:ok), Opt(:key_F10), Label.YesButton)), Bottom(PushButton(Id(:cancel), Opt(:key_F9), Label.NoButton)) ) ), HSpacing(3) ) UI.OpenDialog(Opt(:decorated), contents) ret = UI.UserInput delete = false if ret != :ok delete_home = Convert.to_boolean( UI.QueryWidget(Id(:delete_home), :Value) ) UI.CloseDialog else # yes-no popup. %1 is username if !Popup.YesNo( Builtins.sformat(_("\nReally delete the user %1?\n"), username) ) delete = false end end end if delete Users.DeleteUser(delete_home) return :delete end nil end |
- (Object) EncryptionPopup
Popup for choosing the password encryption method.
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 |
# File '../../src/include/users/widgets.rb', line 439 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() ) ) ) = nil begin = UI.UserInput if == :help Wizard.ShowHelp(help_text) elsif == :ok method = Convert.to_string( UI.QueryWidget(Id(:methods), :CurrentButton) ) Builtins.y2milestone("Changing encryption method to %1", method) end end while != :ok && != :cancel UI.CloseDialog method end |
- (Object) get_module_data(client)
helper function to get information about authentication from appropriate module
2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 |
# File '../../src/include/users/widgets.rb', line 2311 def get_module_data(client) ret = "" progress_orig = Progress.set(false) if !Builtins.contains(@installed_clients, client) ret = Summary.NotConfigured elsif client == "ldap" Ldap.Read ret = Ldap.ShortSummary elsif client == "nis" WFM.CallFunction("nis_auto", ["Read"]) a = WFM.CallFunction("nis_auto", ["ShortSummary"]) ret = Convert.to_string(a) if Ops.is_string?(a) elsif client == "kerberos" WFM.CallFunction("kerberos-client_auto", ["Read"]) a = WFM.CallFunction("kerberos-client_auto", ["ShortSummary"]) ret = Convert.to_string(a) if Ops.is_string?(a) elsif client == "samba" WFM.CallFunction("samba-client_auto", ["Read"]) a = WFM.CallFunction("samba-client_auto", ["ShortSummary"]) ret = Convert.to_string(a) if Ops.is_string?(a) end Progress.set(progress_orig) ret end |
- (Object) GetExpertList
return the list of menu items of “Expert Options” menubutton
1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 |
# File '../../src/include/users/widgets.rb', line 1456 def GetExpertList expert_list = [] if Autologin.available expert_list = Builtins.add( expert_list, # menubutton label Item(Id(:autologinconf), _("&Login Settings")) ) end if !Mode.config expert_list = Builtins.prepend( expert_list, # menubutton label Item(Id(:enc), _("Password &Encryption")) ) if !Stage.cont expert_list = Builtins.add( expert_list, # menubutton label Item(Id(:save), _("&Write Changes Now")) ) end end deep_copy(expert_list) end |
- (Object) GetLDAPExpertList
return the list of menu items for LDAP expert options
1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 |
# File '../../src/include/users/widgets.rb', line 1483 def GetLDAPExpertList expert_list = [] if !Mode.config && Users.LDAPAvailable && !Users.LDAPModified expert_list = Builtins.add( expert_list, # menubutton label Item(Id(:ldapfilter), _("LDAP &Search Filter")) ) expert_list = Builtins.add( expert_list, # menubutton label Item(Id(:ldapconf), _("L&DAP User and Group Configuration")) ) end deep_copy(expert_list) end |
- (Object) GetSetsItems(set)
================================================================
1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 |
# File '../../src/include/users/widgets.rb', line 1425 def GetSetsItems(set) items = [] if set == "users" Builtins.foreach(Users.GetAvailableUserSets) do |set2| items = Builtins.add( items, Item(Id(set2), Ops.get_string(@userset_to_string, set2, "")) ) end # menubutton item items = Builtins.add( items, Item(Id(:customize), _("Customi&ze Filter...")) ) else Builtins.foreach(Users.GetAvailableGroupSets) do |set2| items = Builtins.add( items, Item(Id(set2), Ops.get_string(@groupset_to_string, set2, "")) ) end # menubutton item items = Builtins.add( items, Item(Id(:customize), _("Customi&ze Filter...")) ) end deep_copy(items) end |
- (String) GroupsDialogHelp
Help for usersGroups.
1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 |
# File '../../src/include/users/widgets.rb', line 1597 def GroupsDialogHelp Ops.add( Ops.add( Ops.add( Ops.add( Ops.add( help_main_start, # help text 1/4 _( "\n" + "<p>\n" + "Use this dialog to get information about existing groups and add or modify groups.\n" + "</p>\n" ) ), # help text 2/4 _( "<p>\n" + "To shift to the user dialog, select <b>Users</b>.\n" + "</p>\n" ) ), # help text 3/4 _( "\n" + "<p>\n" + "To create a new group, click <b>Add</b>.\n" + "</p>\n" ) ), # help text 4/4 _( "<p>\n" + "To edit or delete an existing group, select one group from the list and\n" + "click <b>Edit</b> or <b>Delete</b>.\n" + "</p>\n" ) ), help_main_end ) end |
- (Object) HandleAuthData(key, event)
Handler for actions in Authentication tab
2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 |
# File '../../src/include/users/widgets.rb', line 2411 def HandleAuthData(key, event) event = deep_copy(event) return nil if Ops.get_string(event, "EventType", "") != "MenuEvent" = Ops.get_string(event, "ID", "") return nil if !Builtins.contains(@configurable_clients, ) if !Builtins.contains(@installed_clients, ) package = Builtins.sformat("yast2-%1-client", ) if @check_available avai = Package.Available(package) if avai == nil # package manager is probably not accessible -> no more checks @check_available = false end if avai != true # error popup, %1 is package name Popup.Error( Builtins.sformat( _("Package %1 is not available for installation."), package ) ) @configurable_clients = Builtins.filter(@configurable_clients) do |p| p != end UI.ChangeWidget(Id("auth_summary"), :Value, reload_config([])) return nil end end if Package.InstallAllMsg( [package], # popup label (%1 is package to install) Builtins.sformat( _("Package %1 is not installed.\nInstall it now?\n"), package ) ) @installed_clients = Builtins.add(@installed_clients, ) else return nil end end param = installation ? ["from_users"] : [] if WFM.CallFunction(Ops.get_string(@call_module, , ), param) == :next UI.ChangeWidget(Id("auth_summary"), :Value, reload_config([])) end nil end |
- (Object) HandleBrowseDirectory(key, event)
universal handler for directory browsing
1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 |
# File '../../src/include/users/widgets.rb', line 1915 def HandleBrowseDirectory(key, event) event = deep_copy(event) return nil if Ops.get(event, "ID") != key val = Builtins.substring(key, 7) current = Convert.to_string(UI.QueryWidget(Id(val), :Value)) current = "" if current == nil # directory location popup label dir = UI.AskForExistingDirectory(current, _("Path to Directory")) UI.ChangeWidget(Id(val), :Value, dir) if dir != nil nil end |
- (Object) HandleFilterLine(widget_id, event)
2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 |
# File '../../src/include/users/widgets.rb', line 2222 def HandleFilterLine(, event) event = deep_copy(event) ev_id = Ops.get(event, "ID") current_summary = UsersCache.GetCurrentSummary if current_summary == "users" && Ops.is_string?(ev_id) && Builtins.contains( Users.GetAvailableUserSets, Convert.to_string(ev_id) ) if ev_id == "ldap" && Ldap.bind_pass == nil Ldap.SetBindPassword(Ldap.GetLDAPPassword(true)) return nil if Ldap.bind_pass == nil end popup = false if ev_id == "ldap" && Users.LDAPNotRead || ev_id == "nis" && Users.NISNotRead UI.OpenDialog( Opt(:decorated), # wait popup Label(_("Reading sets of users and groups. Please wait...")) ) popup = true end if Users.ChangeCurrentUsers(Convert.to_string(ev_id)) if popup UI.CloseDialog popup = false end UsersCache.SetCustomizedUsersView(ev_id == "custom") SummaryTableInit("table") InitFilterLine() InitTabUsersGroups("") end UI.CloseDialog if popup return nil end if current_summary == "groups" && Ops.is_string?(ev_id) && Builtins.contains( Users.GetAvailableGroupSets, Convert.to_string(ev_id) ) if ev_id == "ldap" && Ldap.bind_pass == nil Ldap.SetBindPassword(Ldap.GetLDAPPassword(true)) end popup = false if ev_id == "ldap" && Users.LDAPNotRead || ev_id == "nis" && Users.NISNotRead UI.OpenDialog( Opt(:decorated), # wait popup Label(_("Reading sets of users and groups. Please wait...")) ) popup = true end if Users.ChangeCurrentGroups(Convert.to_string(ev_id)) if popup UI.CloseDialog popup = false end UsersCache.SetCustomizedGroupsView(ev_id == "custom") SummaryTableInit("table") InitFilterLine() InitTabUsersGroups("") end UI.CloseDialog if popup return nil end if ev_id == :customize if CustomizePopup(current_summary) && UsersCache.CustomizedUsersView SummaryTableInit("table") end InitFilterLine() InitTabUsersGroups("") return nil end if !Ops.is_symbol?(ev_id) Builtins.y2error("strange ev_id value: %1", ev_id) return nil end Convert.to_symbol(ev_id) end |
- (Object) HandleSummaryTable(widget_id, event)
Handler for users/groups summary table
2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 |
# File '../../src/include/users/widgets.rb', line 2006 def HandleSummaryTable(, event) event = deep_copy(event) ev_id = Ops.get(event, "ID") current_summary = UsersCache.GetCurrentSummary ev_id = :edit if ev_id == "table" if ev_id == :new error = "" if current_summary == "users" current_users = Users.GetCurrentUsers if Ops.greater_than(Builtins.size(current_users), 1) set = ChooseTypePopup(current_users, "user") return nil if set == "" current_users = Builtins.filter(current_users) { |u| u != set } current_users = Builtins.prepend(current_users, set) Users.SetCurrentUsers(current_users) end error = Users.AddUser({}) else current_groups = Users.GetCurrentGroups if Ops.greater_than(Builtins.size(current_groups), 1) set = ChooseTypePopup(current_groups, "group") return nil if set == "" current_groups = Builtins.filter(current_groups) { |u| u != set } current_groups = Builtins.prepend(current_groups, set) Users.SetCurrentGroups(current_groups) end error = Users.AddGroup({}) end if error != "" Popup.Error(error) return nil end end if ev_id == :edit || ev_id == :delete selected = Convert.to_string(UI.QueryWidget(Id("table"), :CurrentItem)) if selected != nil error = "" UsersCache.SetCurrentFocus(selected) if current_summary == "users" Users.SelectUserByName(selected) if ev_id == :delete ev_id = DeleteUserPopup() else error = Users.EditUser({}) end else Users.SelectGroupByName(selected) if UsersCache.GetGroupType == "nis" # error popup Report.Message( _( "NIS groups can only be\nmodified and deleted on the server.\n" ) ) ev_id = nil end if ev_id == :delete ev_id = DeleteGroupPopup() else error = Users.EditGroup({}) end end if error != "" Report.Error(error) return nil end else # error popup Report.Message(_("Select an entry from the table.")) return nil end end if ev_id == :enc enc = EncryptionPopup() if enc != Users.EncryptionMethod if enc != "des" && Users.NISMaster && !Users.NotAskNISServerNotDES return nil if AskForNISServerEncryptionPopup(enc) != :ok end Users.SetEncryptionMethod(enc) end return nil end if ev_id == :autologinconf AutologinPopup() return nil end if ev_id == :save if !Users.Modified #popup message (user wants to save but there is no modification) Popup.Message(_("There are no changes to save.")) return nil end Wizard.CreateDialog Wizard.SetDesktopTitleAndIcon("users") ret = WriteDialog(true) Wizard.CloseDialog Builtins.y2milestone("WriteDialog returned %1", ret) # LDAP expert options could be available again SummaryTableInit("table") return nil end if ev_id == :ldapfilter # change of search filter (only when LDAP was not modified yet) if LDAPSearchFilterPopup() && !Users.LDAPModified Users.SetLDAPNotRead(true) current = current_summary == "users" ? Users.GetCurrentUsers : Users.GetCurrentGroups if Builtins.contains(current, "ldap") # simulate the action "show LDAP users" HandleFilterLine(, { "ID" => "ldap" }) end # now update the other list (not current_summary) current = current_summary == "users" ? Users.GetCurrentGroups : Users.GetCurrentUsers if Builtins.contains(current, "ldap") # customize view is lost... TODO if current_summary == "users" Users.ChangeCurrentGroups("ldap") else Users.ChangeCurrentUsers("ldap") end end end return nil end if ev_id == :ldapconf if LdapAdministrationDialog() && Ldap.ldap_modified if !Users.LDAPNotRead && # yes/no popup (data were changed) Popup.YesNo(_("Reread all data from LDAP server?")) # read all LDAP configuration again! Users.SetLDAPNotRead(true) UsersLDAP.SetFiltersRead(false) UsersLDAP.SetInitialized(false) current = current_summary == "users" ? Users.GetCurrentUsers : Users.GetCurrentGroups if Builtins.contains(current, "ldap") # simulate the action "show LDAP users" HandleFilterLine(, { "ID" => "ldap" }) end # now update the other list (not current_summary) current = current_summary == "users" ? Users.GetCurrentGroups : Users.GetCurrentUsers if Builtins.contains(current, "ldap") # customize view is lost... TODO if current_summary == "users" Users.ChangeCurrentGroups("ldap") else Users.ChangeCurrentUsers("ldap") end end end Ldap.ldap_modified = false end return nil end if !Ops.is_symbol?(ev_id) Builtins.y2error("strange ev_id value: %1", ev_id) return nil end Convert.to_symbol(ev_id) end |
- (String) help_main_end
Last part of the help text.
1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 |
# File '../../src/include/users/widgets.rb', line 1519 def help_main_end = Stage.cont ? Label.NextButton : Label.FinishButton # help text 1/3 Ops.add( _( "<p>\n" + "Users and groups are arranged in various sets. Change the set currently shown in the table with <b>Set Filter</b>.\n" + "Customize your view with <b>Customize Filter</b>.</p>\n" ) + # help text 2/3 _( "<p>\n" + "Click <b>Expert Options</b> to edit various expert settings, such as\n" + "password encryption type, user authentication method, default values for new\n" + "users, or login settings. With <b>Write Changes Now</b>, save\n" + "all changes made so far without exiting the configuration module.</p>\n" ), # help text 3/3, %1 is translated button label Builtins.sformat( _( "<p>\n" + "To save the modified user and group settings to your system, press\n" + "<b>%1</b>.\n" + "</p>\n" ), String.RemoveShortcut() ) ) end |
- (String) help_main_start
First part of the help text.
1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 |
# File '../../src/include/users/widgets.rb', line 1505 def help_main_start # help text 1/1 _( "<p>\n" + "Linux is a multiuser system. Several different users can be logged in to the\n" + "system at the same time. To avoid confusion, each user must have\n" + "a unique identity. Additionally, every user belongs to at least one group.\n" + "</p>\n" ) end |
- (Object) InitAuthData(key)
Init the widgets in Authentication tab
2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 |
# File '../../src/include/users/widgets.rb', line 2361 def InitAuthData(key) mb = [] to_string = { # menubutton label "nis" => _("&NIS"), # menubutton label "nisplus" => _("N&IS+"), # menubutton label "ldap" => _("&LDAP"), # menubutton label "kerberos" => _("&Kerberos"), # menubutton label "samba" => _("&Samba") } # check availability of authentication packages, # update the RichText summary and menubutton labels accordingly Builtins.foreach(@configurable_clients) do |client| package = Builtins.sformat("yast2-%1-client", client) client_item = Item( Id(client), Ops.get_string(to_string, client, client) ) if Package.Installed(package) @installed_clients = Builtins.add(@installed_clients, client) end mb = Builtins.add(mb, client_item) UI.ChangeWidget( Id("auth_summary"), :Value, Ops.add( Convert.to_string(UI.QueryWidget(Id("auth_summary"), :Value)), reload_config([client]) ) ) end if Ops.greater_than(Builtins.size(mb), 0) UI.ReplaceWidget( Id(:rpbutton), # menu button label MenuButton(Opt(:key_F4), _("&Configure..."), mb) ) end nil end |
- (Object) InitDefaults(key)
Initialize all the values in the dialog with new user defaults
1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 |
# File '../../src/include/users/widgets.rb', line 1777 def InitDefaults(key) defaults = Users.GetLoginDefaults items = [] @all_groupnames = UsersCache.GetAllGroupnames defaultgroup = Users.GetDefaultGroupname("local") Builtins.foreach(@all_groupnames) do |grouptype, groupmap| # only local sets next if !Builtins.contains(["local", "system"], grouptype) Builtins.foreach(groupmap) do |group, val| if group == defaultgroup items = Builtins.add(items, Item(Id(group), group, true)) else items = Builtins.add(items, Item(Id(group), group)) end end end UI.ChangeWidget(Id("defaultgroup"), :Items, items) UI.ChangeWidget(Id("shell"), :Items, Users.AllShells) UI.ChangeWidget(Id("shell"), :Value, Users.GetDefaultShell("local")) groups = Users.GetDefaultGrouplist("local") grouplist = Builtins.mergestring(Builtins.maplist(groups) { |g, i| g }, ",") UI.ChangeWidget(Id("groups"), :Value, grouplist) UI.ChangeWidget( Id("home"), :Value, Ops.get_string(defaults, "home", "/home") ) UI.ChangeWidget( Id("skel"), :Value, Ops.get_string(defaults, "skel", "/etc/skel") ) UI.ChangeWidget( Id("inactive"), :Value, Builtins.tointeger(Ops.get_string(defaults, "inactive", "0")) ) expire = Ops.get_string(defaults, "expire", "") exp_date = "" if expire != "0" && expire != "" # 'expire' is expected to be number of days since 1970-01-01 out = Convert.to_map( SCR.Execute( path(".target.bash_output"), Ops.add( Builtins.sformat( "date --date='1970-01-01 00:00:01 %1 days' ", expire ), "+\"%Y-%m-%d\"" ) ) ) exp_date = Builtins.deletechars(Ops.get_string(out, "stdout", ""), "\n") end UI.ChangeWidget(Id("expire"), :Value, exp_date) UI.ChangeWidget( Id("umask"), :Value, Ops.get_string(defaults, "umask", "") ) UI.ChangeWidget(Id("umask"), :InputMaxLength, 3) nil end |
- (Object) InitFilterLine(widget_id)
Initialize the value of the label with current filter and filter selection
2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 |
# File '../../src/include/users/widgets.rb', line 2177 def InitFilterLine() current_summary = UsersCache.GetCurrentSummary curr = "" if current_summary == "users" if UsersCache.CustomizedUsersView curr = Ops.get_string(@userset_to_label, "custom", "") else current_users = Users.GetCurrentUsers curr = Ops.get_string( @userset_to_label, Ops.get_string(current_users, 0, "custom"), "" ) end else if UsersCache.CustomizedGroupsView curr = Ops.get_string(@groupset_to_label, "custom", "") else current_groups = Users.GetCurrentGroups curr = Ops.get_string( @groupset_to_label, Ops.get_string(current_groups, 0, "custom"), "" ) end end UI.ReplaceWidget( Id(:rpfilter), HBox( # label, e.g. 'Filter: Local Users', 'Filter: Custom' Left( Label(Id(:current_filter), Builtins.sformat(_("Filter: %1"), curr)) ), # MenuButton label MenuButton( Id(:sets), Opt(:key_F2), _("&Set Filter"), GetSetsItems(current_summary) ) ) ) nil end |
- (Object) initialize_users_widgets(include_target)
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 |
# File '../../src/include/users/widgets.rb', line 30 def (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", "ldap", "kerberos", "samba"] # save if no more Available calls should be done (bug #225484) @check_available = true @client_label = { # richtext label "nis" => _("NIS"), # richtext label "ldap" => _("LDAP"), # richtext label "kerberos" => _("Kerberos"), # richtext label "samba" => _("Samba") } # name of module to call @call_module = { "samba" => "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", "groups", "shell", HBox("home", VBox(Label(""), "browse_home")), HBox("skel", VBox(Label(""), "browse_skel")), "umask", "expire", "inactive", VSpacing(0.2), VStretch() ), HSpacing(2) ), "widget_names" => [ "defaults_global", "defaultgroup", "groups", "shell", "home", "browse_home", "skel", "browse_skel", "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)" ) }, "groups" => { "widget" => :textentry, # text entry "label" => _("Se&condary Groups"), "no_help" => true, "validate_type" => :function, "validate_function" => fun_ref( method(:ValidateGroupList), "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 }, "skel" => { "widget" => :textentry, # text entry "label" => _("&Skeleton for Home Directory"), "no_help" => true, "validate_type" => :function, "validate_function" => fun_ref( method(:ValidateSkeleton), "boolean (string, map)" ) }, "browse_skel" => { "widget" => :push_button, # push button label "label" => _("Bro&wse..."), "opt" => [:key_F7], "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" => ["ldap", "nis", "kerberos", "samba"] } } end |
- (Object) InitTabUsersGroups(widget_id)
Handle the switch between tabs (load set of items for users or groups)
1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 |
# File '../../src/include/users/widgets.rb', line 1929 def InitTabUsersGroups() current_summary = UsersCache.GetCurrentSummary if current_summary == CWMTab.CurrentTab # tab shows already current set return else UsersCache.ChangeCurrentSummary end nil end |
- (Object) LDAPSearchFilterPopup
Popup for configuration user/group filter for making the LDAP search
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 |
# File '../../src/include/users/widgets.rb', line 609 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) = :notnext begin = Convert.to_symbol(UI.UserInput) if == :help Wizard.ShowHelp(help_text) next end if == :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 == :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 == :ok || == :users || == :groups if ( == :groups || == :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)) = :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)) = :notnext next end user_f = curr_user_f end if ( == :users || == :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)) = :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)) = :notnext next end end group_f = curr_group_f end if == :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 != :ok && != :cancel UI.CloseDialog ret end |
- (Object) reload_config(clients)
Reloads the configuration for given client and creates updated summary widget contents returns the summary value for richtext
2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 |
# File '../../src/include/users/widgets.rb', line 2339 def reload_config(clients) clients = deep_copy(clients) summary = "" if clients == nil || clients == [] clients = deep_copy(@configurable_clients) end Builtins.foreach(clients) do |client| summary = Summary.AddHeader( summary, Builtins.sformat( "<font color=\"#8BC460\"><a href=\"%1\">%2</a></font>", client, Ops.get_string(@client_label, client, client) ) ) summary = Summary.AddLine(summary, get_module_data(client)) end summary end |
- (Object) StoreAuthData(key, event)
Actions done when Authentication tab is left
2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 |
# File '../../src/include/users/widgets.rb', line 2462 def StoreAuthData(key, event) event = deep_copy(event) was_nis_available = Users.NISAvailable was_ldap_available = Users.LDAPAvailable Users.ReadSourcesSettings # enabling NIS/LDAP could add + lines (they are not in current cache that # would be saved after user modifications): if !was_nis_available && Users.NISAvailable || !was_ldap_available && Users.LDAPAvailable Builtins.y2milestone("ldap or nis enabled now") Users.AddPlusPasswd("+::::::") Users.AddPlusGroup("+:::") Users.AddPlusShadow("+") end nil end |
- (Object) StoreDefaults(key, event)
Store all the values from the dialog with new user defaults (when leaving the dialog)
1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 |
# File '../../src/include/users/widgets.rb', line 1849 def StoreDefaults(key, event) event = deep_copy(event) defaults = Users.GetLoginDefaults new_defaults = {} Builtins.foreach(["home", "shell", "skel", "inactive", "umask"]) do |key2| val = UI.QueryWidget(Id(key2), :Value) val = Builtins.sformat("%1", val) if Ops.is_integer?(val) if Ops.get(defaults, key2) != val Ops.set(new_defaults, key2, Convert.to_string(val)) end end new_grouplist = Convert.to_string(UI.QueryWidget(Id("groups"), :Value)) if Builtins.sort( Builtins.splitstring(Ops.get_string(defaults, "groups", ""), ",") ) != Builtins.sort(Builtins.splitstring(new_grouplist, ",")) Ops.set(new_defaults, "groups", new_grouplist) end new_exp_date = Convert.to_string(UI.QueryWidget(Id("expire"), :Value)) new_expire = Ops.get_string(defaults, "expire", "") if new_exp_date == "" new_expire = "" else out = Convert.to_map( SCR.Execute( path(".target.bash_output"), Ops.add( Builtins.sformat("date --date='%1 UTC' ", new_exp_date), "+%s" ) ) ) seconds_s = Builtins.deletechars( Ops.get_string(out, "stdout", "0"), "\n" ) if seconds_s != "" days = Ops.divide(Builtins.tointeger(seconds_s), 60 * 60 * 24) new_expire = Builtins.sformat("%1", days) end end if new_expire != Ops.get_string(defaults, "expire", "") Ops.set(new_defaults, "expire", new_expire) end new_defgroup = Convert.to_string( UI.QueryWidget(Id("defaultgroup"), :Value) ) if Users.GetDefaultGroupname("local") != new_defgroup g = Users.GetGroupByName(new_defgroup, "") Ops.set( new_defaults, "group", Builtins.sformat( "%1", GetInt(Ops.get(g, "gidNumber"), Users.GetDefaultGID("local")) ) ) end Users.SetLoginDefaults(new_defaults, new_defgroup) if new_defaults != {} nil end |
- (Object) SummaryTableInit(widget_id)
Initialize the contents of Summary Table widget
1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 |
# File '../../src/include/users/widgets.rb', line 1942 def SummaryTableInit() items = [] current_summary = UsersCache.GetCurrentSummary if current_summary == "users" items = UsersCache.GetUserItems UI.ReplaceWidget( Id(:rptable), Table( Id("table"), Opt(:notify), Header( # table header _("Login"), # table header _("Name"), # table header _("UID"), # table header _("Groups") ), [] ) ) else items = UsersCache.GetGroupItems UI.ReplaceWidget( Id(:rptable), Table( Id("table"), Opt(:notify), Header( # table header _("Group Name"), # table header _("Group ID"), # table header _("Group Members") ), [] ) ) end UI.ChangeWidget(Id(), :Items, items) if Ops.greater_than(Builtins.size(items), 0) UI.SetFocus(Id()) focusline = UsersCache.GetCurrentFocus if focusline != nil UI.ChangeWidget(Id(), :CurrentItem, focusline) end end UI.ReplaceWidget( Id(:rpexpert), # Menu Buton label MenuButton( Id(:expertlist), _("E&xpert Options"), Builtins.union(GetExpertList(), GetLDAPExpertList()) ) ) nil end |
- (String) UsersDialogHelp
Help for UsersDialog.
1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 |
# File '../../src/include/users/widgets.rb', line 1552 def UsersDialogHelp # help text 1/4 Ops.add( Ops.add( Ops.add( Ops.add( Ops.add( help_main_start, _( "\n" + "<p>\n" + "Use this dialog to get information about existing users and add or modify\n" + "users. \n" + "</p>\n" ) ), # help text 2/4 _( "<p>\n" + "To shift to the group dialog, select <b>Groups</b>.\n" + "</p>\n" ) ), # help text 3/4 _( "\n" + "<p>\n" + "To create a new user, click <b>Add</b>.\n" + "</p>\n" ) ), # help text 4/4 _( "<p>\n" + "To edit or delete an existing user, select one user from the list and\n" + "click <b>Edit</b> or <b>Delete</b>.\n" + "</p>\n" ) ), help_main_end ) end |
- (Object) ValidateExpire(key, event)
Validation function for the default value of account expiration
1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 |
# File '../../src/include/users/widgets.rb', line 1643 def ValidateExpire(key, event) event = deep_copy(event) new_exp_date = Convert.to_string(UI.QueryWidget(Id(key), :Value)) if new_exp_date != "" && !Builtins.regexpmatch( new_exp_date, "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" ) # popup label - don't reorder the letters YYYY-MM-DD # The date must stay in this format Report.Error(_("The expiration date must be in the format YYYY-MM-DD.")) UI.SetFocus(Id(key)) return false end true end |
- (Object) ValidateGroupList(key, event)
Validation function for the value of the default list of groups
1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 |
# File '../../src/include/users/widgets.rb', line 1712 def ValidateGroupList(key, event) event = deep_copy(event) groups = Users.GetDefaultGrouplist("local") grouplist = Builtins.mergestring(Builtins.maplist(groups) { |g, i| g }, ",") new_grouplist = Convert.to_string(UI.QueryWidget(Id(key), :Value)) if new_grouplist != grouplist l_grouplist = [] dont_exist = [] Builtins.foreach(Builtins.splitstring(new_grouplist, ",")) do |g| # check for group existence if Ops.get(@all_groupnames, ["local", g], 0) == 0 && Ops.get(@all_groupnames, ["system", g], 0) == 0 dont_exist = Convert.convert( Builtins.union(dont_exist, [g]), :from => "list", :to => "list <string>" ) else # filter out the duplicates l_grouplist = Convert.convert( Builtins.union(l_grouplist, [g]), :from => "list", :to => "list <string>" ) end end if dont_exist != [] # error message Report.Error( Builtins.sformat( _( "These groups do not exist in your system:\n" + "%1\n" + "Try again.\n" ), Builtins.mergestring(dont_exist, ",") ) ) UI.SetFocus(Id("groups")) return false end new_grouplist = Builtins.mergestring(l_grouplist, ",") UI.ChangeWidget(Id("groups"), :Value, new_grouplist) end true end |
- (Object) ValidateHomePrefix(key, event)
Validation function for the default home prefix
1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 |
# File '../../src/include/users/widgets.rb', line 1679 def ValidateHomePrefix(key, event) event = deep_copy(event) new_home = Convert.to_string(UI.QueryWidget(Id(key), :Value)) if SCR.Read(path(".target.dir"), new_home) == nil if SCR.Read(path(".target.size"), new_home) != -1 # error message Report.Error( _( "The entered path prefix for home is not a directory.\nTry again.\n" ) ) UI.SetFocus(Id(key)) return false else # yes/no popup if Popup.YesNo( _("The selected directory does not exist.\nCreate it now?\n") ) if !Convert.to_boolean(SCR.Execute(path(".target.mkdir"), new_home)) Report.Error(Message.UnableToCreateDirectory(new_home)) UI.SetFocus(Id(key)) return false end else UI.SetFocus(Id(key)) return false end end end true end |
- (Object) ValidateShell(key, event)
Validation function for the default login shell
1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 |
# File '../../src/include/users/widgets.rb', line 1762 def ValidateShell(key, event) event = deep_copy(event) new_shell = Convert.to_string(UI.QueryWidget(Id(key), :Value)) if !Builtins.contains(Users.AllShells, new_shell) # Yes-No popup return Popup.YesNo( _( "If you select a nonexistent shell, the user\nmay be unable to log in. Continue?\n" ) ) end true end |
- (Object) ValidateSkeleton(key, event)
Validation function for home directory skeleton directory
1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 |
# File '../../src/include/users/widgets.rb', line 1662 def ValidateSkeleton(key, event) event = deep_copy(event) new_skel = Convert.to_string(UI.QueryWidget(Id(key), :Value)) if SCR.Read(path(".target.dir"), new_skel) == nil # popup error label Report.Error( _( "The entered home directory skeleton is not a directory.\nTry again.\n" ) ) UI.SetFocus(Id(key)) return false end true end |