~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/makeuser.py

MergedĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
    """
80
80
    users = store.find(ivle.database.User)
81
81
    groups = {}
82
 
    for u in users:
83
 
        role = str(u.role)
84
 
        if role not in groups:
85
 
            groups[role] = []
86
 
        groups[role].append(u.login)
 
82
    # TODO: Populate groups with per-offering tutors/lecturers/etc.
87
83
    f = open(ivle.conf.svn_conf + ".new", "w")
88
84
    f.write("# IVLE SVN Repositories Configuration\n")
89
85
    f.write("# Auto-generated on %s\n" % time.asctime())
197
193
        raise Exception("Must run make_jail as root")
198
194
    
199
195
    # tempdir is for putting backup homes in
200
 
    tempdir = os.path.join(ivle.conf.jail_base, '__temp__')
 
196
    tempdir = os.path.join(ivle.conf.jail_src_base, '__temp__')
201
197
    if not os.path.exists(tempdir):
202
198
        os.makedirs(tempdir)
203
199
    elif not os.path.isdir(tempdir):
227
223
        # Change the ownership of all the files to the right unixid
228
224
        logging.debug("chown %s's home directory files to uid %d"
229
225
            %(user.login, user.unixid))
230
 
        os.chown(userhomedir, user.unixid, user.unixid)
231
 
        for root, dirs, files in os.walk(userhomedir):
232
 
            for fsobj in dirs + files:
233
 
                os.chown(os.path.join(root, fsobj), user.unixid, user.unixid)
 
226
        os.spawnvp(os.P_WAIT, 'chown', ['chown', '-R', '%d:%d' % (user.unixid,
 
227
                                        user.unixid), userhomedir])
234
228
    else:
235
229
        # No user jail exists
236
230
        # Set up the user's home directory