summaryrefslogtreecommitdiffstats
path: root/users.py
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2007-09-12 19:53:58 +0000
committerChris Lumens <clumens@redhat.com>2007-09-12 19:53:58 +0000
commit1b4c27db6ba998b256380cd4f86c3f9bdf1110f6 (patch)
treeb0e7368d5f6513f6466f385feca47400bf0b102e /users.py
parenta8ead02bdb1c67e6ca3a98eca89a138d7bb4aee9 (diff)
downloadanaconda-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.
Diffstat (limited to 'users.py')
-rw-r--r--users.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/users.py b/users.py
index b4b29a3e3..b5b8ef2db 100644
--- a/users.py
+++ b/users.py
@@ -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")