diff options
author | Chris Lumens <clumens@redhat.com> | 2007-09-12 19:53:58 +0000 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2007-09-12 19:53:58 +0000 |
commit | 1b4c27db6ba998b256380cd4f86c3f9bdf1110f6 (patch) | |
tree | b0e7368d5f6513f6466f385feca47400bf0b102e | |
parent | a8ead02bdb1c67e6ca3a98eca89a138d7bb4aee9 (diff) | |
download | anaconda-1b4c27db6ba998b256380cd4f86c3f9bdf1110f6.tar.gz anaconda-1b4c27db6ba998b256380cd4f86c3f9bdf1110f6.tar.xz anaconda-1b4c27db6ba998b256380cd4f86c3f9bdf1110f6.zip |
Make the default group of a new user be the one created with their username.
Modify entries for all the other groups a user should be in to make that work.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | users.py | 16 |
2 files changed, 14 insertions, 6 deletions
@@ -3,6 +3,10 @@ * instdata.py (InstallData.writeKS): Write out user and services commands and scripts to anaconda-ks.cfg if doing a kickstart install. + * users.py (Users.createUser): Make the default group of a new user + be the one created with their username. Modify entries for all the + other groups a user should be in to make that work. + 2007-09-12 Peter Jones <pjones@redhat.com> * isys/nl.c (netlink_init_interfaces_list): Rework recvmsg code to @@ -67,12 +67,10 @@ class Users: userEnt = self.admin.initUser(name) groupEnt = self.admin.initGroup(name) - gidLst = map(lambda grp: grp.get(libuser.GIDNUMBER)[0], - filter(lambda grp: grp, - map(lambda name: self.admin.lookupGroupByName(name), groups))) - gidLst.extend(groupEnt.get(libuser.GIDNUMBER)) - - userEnt.set(libuser.GIDNUMBER, gidLst) + grpLst = filter(lambda grp: grp, + map(lambda name: self.admin.lookupGroupByName(name), groups)) + userEnt.set(libuser.GIDNUMBER, [groupEnt.get(libuser.GIDNUMBER)[0]] + + map(lambda grp: grp.get(libuser.GIDNUMBER)[0], grpLst)) if not homedir: homedir = "/home/" + name @@ -101,9 +99,15 @@ class Users: if lock: self.admin.lockUser(userEnt) + # Add the user to all the groups they should be part of. + for grp in grpLst: + grp.add(libuser.MEMBERNAME, name) + self.admin.modifyGroup(grp) + # Now set the correct home directory to fix up passwd. userEnt.set(libuser.HOMEDIRECTORY, homedir) self.admin.modifyUser(userEnt) + return True def setRootPassword(self, password, isCrypted, useMD5, lock): rootUser = self.admin.lookupUserByName("root") |