Author: jsuchome
Date: Thu Jan 17 10:42:02 2008
New Revision: 43691
URL: http://svn.opensuse.org/viewcvs/yast?rev=43691&view=rev
Log:
- support more user groups in kiwi configuration (#346501)
Modified:
trunk/product-creator/package/yast2-product-creator.changes
trunk/product-creator/src/Kiwi.ycp
trunk/product-creator/src/kiwi_dialogs.ycp
Modified: trunk/product-creator/package/yast2-product-creator.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/package/yast2-product-creator.changes?rev=43691&r1=43690&r2=43691&view=diff
==============================================================================
--- trunk/product-creator/package/yast2-product-creator.changes (original)
+++ trunk/product-creator/package/yast2-product-creator.changes Thu Jan 17 10:42:02 2008
@@ -1,4 +1,9 @@
-------------------------------------------------------------------
+Thu Jan 17 10:23:52 CET 2008 - jsuchome@suse.cz
+
+- support more user groups in kiwi configuration (#346501)
+
+-------------------------------------------------------------------
Fri Jan 4 13:31:35 CET 2008 - lslezak@suse.cz
- do not call Pkg::SaveState() and Pkg::RestoreState(), the state
Modified: trunk/product-creator/src/Kiwi.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/Kiwi.ycp?rev=43691&r1=43690&r2=43691&view=diff
==============================================================================
--- trunk/product-creator/src/Kiwi.ycp (original)
+++ trunk/product-creator/src/Kiwi.ycp Thu Jan 17 10:42:02 2008
@@ -324,11 +324,11 @@
foreach (string user, map usermap, (map) config["users"]:$[], {
if (!haskey (ret, "users"))
ret["users"] = $[];
- if (haskey (usermap, "group"))
- ret["group"] = usermap["group"]:"";
ret["users",user] = $[
"home" : usermap["home"]:sformat ("/home/%1", user),
- "pwd" : user
+ "pwd" : user,
+ "group" : usermap["group"]:"",
+ "username" : user,
];
});
return ret;
@@ -503,19 +503,29 @@
write_list[0,"inherit"] = KiwiConfig["inherit"]:"";
if (haskey (KiwiConfig, "users"))
{
- write_list[0,"__children"] = add (write_list[0,"__children"]:[], $[
- "__key" : "users",
- "group" : KiwiConfig["group"]:"users",
- "__children" :
- maplist (string user, map usermap, (map) KiwiConfig["users"]:$[], ``(
+ map groups2users = $[];
+ foreach (string user, map usermap, (map) KiwiConfig["users"]:$[], {
+ string g = usermap["group"]:"";
+ if (g == "")
+ g = user == "root" ? "root" : "users";
+ if (!haskey (groups2users, g))
+ groups2users[g] = [];
+ groups2users[g] = add (groups2users[g]:[], usermap);
+ });
+ foreach (string group, list userlist, groups2users, {
+ write_list[0,"__children"] = add (write_list[0,"__children"]:[], $[
+ "__key" : "users",
+ "group" : group,
+ "__children" : maplist (map usermap, (list<map>) userlist, ``(
$[
"__key" : "user",
- "name" : user,
+ "name" : usermap["username"]:"",
"pwd" : crypt_password (usermap["pwd"]:""),
"home" : usermap["home"]:"",
]
))
- ]);
+ ]);
+ });
}
write_list[0,"__children"] = union (write_list[0,"__children"]:[],
maplist (string source, (list<string>) KiwiConfig["sources"]:[],
Modified: trunk/product-creator/src/kiwi_dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/product-creator/src/kiwi_dialogs.ycp?rev=43691&r1=43690&r2=43691&view=diff
==============================================================================
--- trunk/product-creator/src/kiwi_dialogs.ycp (original)
+++ trunk/product-creator/src/kiwi_dialogs.ycp Thu Jan 17 10:42:02 2008
@@ -336,7 +336,7 @@
define void InitUsersTable (string id) {
list items = maplist (string user, map usermap, (map) KiwiConfig["users"]:$[],
- ``(`item (`id (user), user, usermap["home"]:"")));
+ ``(`item (`id (user), user, usermap["home"]:"", usermap["group"]:"users")));
UI::ChangeWidget (`id ("table"), `Items, items);
UI::ChangeWidget (`id ("edituser"), `Enabled, size (items) > 0);
UI::ChangeWidget (`id ("deleteuser"), `Enabled, size (items) > 0);
@@ -360,6 +360,7 @@
`Password (`id (`pw1), Label::Password(), ""),
`Password (`id(`pw2), Label::ConfirmPassword(), ""),
`TextEntry (`id (`home), _("&Home Directory")),
+ `TextEntry (`id (`group), _("&Group Name")),
`HBox (
`PushButton (`id(`ok),`opt(`key_F10), Label::OKButton()),
`PushButton (`id(`cancel),`opt(`key_F9), Label::CancelButton())
@@ -370,6 +371,7 @@
{
UI::ChangeWidget (`id (`username), `Value, current_user);
UI::ChangeWidget (`id (`home), `Value, KiwiConfig["users", current_user, "home"]:"");
+ UI::ChangeWidget (`id (`group), `Value, KiwiConfig["users", current_user, "group"]:"users");
UI::ChangeWidget (`id (`pw1), `Value, "*****");
UI::ChangeWidget (`id (`pw2), `Value, "*****");
// popup label
@@ -409,9 +411,14 @@
KiwiConfig["users"] = $[];
else if (key == "edituser" && username != current_user)
KiwiConfig["users"] = remove (KiwiConfig["users"]:$[], current_user);
+ string group = (string) UI::QueryWidget (`id(`group), `Value);
+ if (group == "")
+ group = username == "root" ? "root" : "users";
KiwiConfig["users", username] = $[
"pwd" : pwd,
- "home" : UI::QueryWidget (`id(`home), `Value)
+ "home" : UI::QueryWidget (`id(`home), `Value),
+ "group" : group,
+ "username" : username,
];
}
} until (ret == `ok || ret == `cancel);
@@ -934,7 +941,7 @@
`VBox (
"general_users",
`VSpacing (0.2),
- "group",
+// "group",
`VSpacing (0.2),
"userstable",
`VSpacing (0.2),
@@ -1346,6 +1353,7 @@
// general help for users tab
"help" : _("<p>Here, create users that should be available in the target system.</p>"),
],
+ /*
"group" : $[
"widget" : `textentry,
// textentry label
@@ -1355,15 +1363,20 @@
"store" : StoreDescription,
"handle" : HandleDescription,
],
+ */
"userstable" : $[
"widget" : `custom,
"custom_widget" : `Table (`id("table"), `opt (`notify), `header(
// table header
_("Name"),
// table header
- _("Home Directory"))),
+ _("Home Directory"),
+ // table header
+ _("Group"))
+ ),
// help for table with users
- "help" : _("<p>For each user, specify <b>Name</b>, <b>Password</b>, and <b>Home Directory</b>.</p>"),
+ "help" : _("<p>For each user, specify <b>Name</b>, <b>Password</b>, <b>Home Directory</b> and group
+to which the users belongs.</p>"),
"init" : InitUsersTable,
"handle" : HandleAddEditUser,
],
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org