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

« back to all changes in this revision

Viewing changes to ivle/makeuser.py

  • Committer: William Grant
  • Date: 2009-01-20 01:02:29 UTC
  • mto: This revision was merged to the branch mainline in revision 1090.
  • Revision ID: grantw@unimelb.edu.au-20090120010229-592qbjx4q13jc4ue
www/apps/userservice: create_user now creates and enrols the User itself, not
    using ivle.makeuser.create_user_db.

ivle.makeuser.create_user_db: Kill. Unused.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
import filecmp
46
46
import logging
47
47
import ivle.conf
48
 
import ivle.db
49
48
import ivle.pulldown_subj
50
49
 
51
50
from ivle.database import ProjectGroup
305
304
                      % (username, unixid, unixid, username))
306
305
    passwd_file.close()
307
306
 
308
 
def make_user_db(throw_on_error = True, **kwargs):
309
 
    """Creates a user's entry in the database, filling in all the fields.
310
 
    All arguments must be keyword args. They are the fields in the table.
311
 
    However, instead of supplying a "passhash", you must supply a
312
 
    "password" argument, which will be hashed internally.
313
 
    Also do not supply a state. All users are created in the "no_agreement"
314
 
    state.
315
 
    Also pulls the user's subjects using the configured subject pulldown
316
 
    module, and adds enrolments to the DB.
317
 
    Throws an exception if the user already exists.
318
 
    """
319
 
    dbconn = ivle.db.DB()
320
 
    dbconn.create_user(**kwargs)
321
 
    dbconn.close()
322
 
 
323
 
    # Pulldown subjects and add enrolments
324
 
    ivle.pulldown_subj.enrol_user(kwargs['login'])
325
 
 
326
307
def mount_jail(login):
327
308
    # This is where we'll mount to...
328
309
    destdir = os.path.join(ivle.conf.jail_base, login)