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

« back to all changes in this revision

Viewing changes to ivle/makeuser.py

  • Committer: William Grant
  • Date: 2009-12-07 11:01:50 UTC
  • mfrom: (1341.1.3 trunk)
  • Revision ID: grantw@unimelb.edu.au-20091207110150-jct30a9yru432ddn
Fix up the project set creation UI a bit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
211
211
    """
212
212
    # filename is, eg, /var/lib/ivle/svn/ivle.auth
213
213
    filename = config['paths']['svn']['auth_ivle']
 
214
    passwd = hashlib.md5(uuid.uuid4().bytes).hexdigest()
214
215
    if os.path.exists(filename):
215
216
        create = ""
216
217
    else:
217
218
        create = "c"
218
219
 
219
220
    user = User.get_by_login(store, login)
220
 
 
221
 
    if user.svn_pass is None:
222
 
        passwd = hashlib.md5(uuid.uuid4().bytes).hexdigest()
223
 
        user.svn_pass = unicode(passwd)
 
221
    user.svn_pass = unicode(passwd)
224
222
 
225
223
    res = subprocess.call(['htpasswd', '-%smb' % create,
226
 
                           filename, login, user.svn_pass])
 
224
                           filename, login, passwd])
227
225
    if res != 0 and throw_on_error:
228
226
        raise Exception("Unable to create ivle-auth for %s" % login)
229
227
 
231
229
    if create == "c":
232
230
        chown_to_webserver(filename)
233
231
 
234
 
    return user.svn_pass
 
232
    return passwd
235
233
 
236
234
def make_jail(user, config, force=True):
237
235
    """Create or update a user's jail.
269
267
        # User jail already exists. Blow it away but preserve their home
270
268
        # directory. It should be all that is there anyway, but you never
271
269
        # know!
272
 
        # Ignore warnings about the use of tempnam
 
270
        # Ignore warnings about the use of tmpnam
273
271
        warnings.simplefilter('ignore')
274
272
        homebackup = os.tempnam(tempdir)
275
273
        warnings.resetwarnings()