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

« back to all changes in this revision

Viewing changes to services/usrmgt-server

  • Committer: matt.giuca
  • Date: 2009-01-14 10:10:12 UTC
  • mto: This revision was merged to the branch mainline in revision 1090.
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:branches%2Fstorm:1132
The new ivle.database.User class is now used in Request and usrmgt, which
    means it is now almost universally used in favour of ivle.user.User (now
    deprecated).

Noticeable change: The minor bug where the change to a user object in the
    database is not reflected in the user's session (eg. changing nick doesn't
    update title until log out).

ivle.dispatch:
    Session now contains 'login' (username string) rather than 'user' (full
        ivle.user.User object). This is a unicode string now.

    req.user is now a ivle.database.User object rather than an ivle.user.User
        object. This makes for a whole lot of really subtle differences, but
        largely conforms to the same interface. Note that strings must now all
        be unicode.

    login: Removed use of ivle.db. Now uses User object.

    html: Now handles unicode login and config options.

ivle.db: Removed update_user. Now replaced with Storm model.

ivle.database: Renamed has_cap back to hasCap (saved for later). Fixed small
    unicode bug.

ivle.makeuser.make_svn_auth now takes a store object.

usrmgt-server: Use new User class.

userservice: Now uses User class internally.
    get_user action now returns ISO 8601 date format, rather than a
        time tuple. (Wasn't being used).
    get_user action no longer transmits local_password (small security risk;
        note that it wasn't possible to see this for any user other than
        yourself unless admin).

ivle.util - added function object_to_dict.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
import logging
6
6
 
7
7
import ivle.conf
8
 
import ivle.db
 
8
import ivle.database
9
9
import ivle.chat
10
10
import ivle.makeuser
11
11
 
40
40
 
41
41
    login = props['login']
42
42
 
43
 
    db = ivle.db.DB()
 
43
    store = ivle.database.get_store()
44
44
 
45
45
    try:
46
46
 
47
47
        # FIXME: check we're pending
48
48
 
49
 
        details = db.get_user(login)
 
49
        # Get the full User object from the db associated with this
 
50
        user = ivle.database.User.get_by_login(store, login)
50
51
 
51
52
        # make svn config/auth
52
53
 
57
58
        rebuild_svn_config(props)
58
59
 
59
60
        logging.debug("Adding Subversion authentication")
60
 
        passwd = ivle.makeuser.make_svn_auth(login, throw_on_error=True)
 
61
        passwd = ivle.makeuser.make_svn_auth(store, login,
 
62
                                             throw_on_error=True)
61
63
        logging.debug("passwd: %s" % passwd)
62
64
 
63
65
        logging.debug("Creating jail")
64
 
        ivle.makeuser.make_jail(login, details.unixid, svn_pass=passwd)
 
66
        ivle.makeuser.make_jail(login, user.unixid, svn_pass=passwd)
65
67
 
66
68
        logging.info("Enabling user")
67
 
        db.update_user(login, state='enabled')
 
69
        user.state = u'enabled'
 
70
 
 
71
        store.commit()
68
72
 
69
73
        return {"response": "okay"}
70
74
 
71
75
    finally:
72
 
        db.close()
 
76
        store.close()
73
77
 
74
78
def rebuild_svn_config(props):
75
79
    """Rebuilds the svn config file