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

« back to all changes in this revision

Viewing changes to scripts/usrmgt-server

  • Committer: William Grant
  • Date: 2009-01-20 01:12:32 UTC
  • mto: This revision was merged to the branch mainline in revision 1090.
  • Revision ID: grantw@unimelb.edu.au-20090120011232-mvxq6n1p8e0pq5z2
ivle.db: insert_problem_attempt and write_problem_save now take a user object,
    not a login, so they don't need to call get_user_loginid. Thus we also
    remove get_user_login_id.
www/apps/tutorialservice: Call the two functions with req.user, not
    req.user.login.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
 
3
 
import sys
4
 
 
5
 
import common.chat
6
 
import common.makeuser
7
 
 
8
 
# usage:
9
 
#   usrmgt-server <port> <magic>
10
 
 
11
 
def create_user(props):
12
 
 
13
 
    if 'uid' not in props:
14
 
        uid = invent-uid
15
 
        props['uid'] = uid
16
 
 
17
 
    common.makeuser.make_user_db(props['username'], props['uid'],
18
 
                                 props['password'], props['nick'],
19
 
                                 props['fullname'], props['rolenm'],
20
 
                                 props['studentid'])
21
 
 
22
 
    common.makeuser.make_jail(props['username'], props['uid'])
23
 
 
24
 
    # eventually, we're going to want to grant shell access, in which
25
 
    # case we'll need to add the uid to the password file. Magic to do
26
 
    # that should go here.
27
 
 
28
 
    return props['uid']
29
 
 
30
 
if __name__ == "__main__":
31
 
    port = int(sys.argv[1])
32
 
    magic = sys.argv[2]
33
 
 
34
 
    common.chat.start_server(port, magic, False, create_user)