404
by drtomc
Version 0 of the usrmgt server. |
1 |
#!/usr/bin/python
|
2 |
||
432
by drtomc
usrmgt: more work on this. Still some work to go. |
3 |
import sys |
4 |
||
5 |
import common.chat |
|
6 |
import common.makeuser |
|
7 |
||
404
by drtomc
Version 0 of the usrmgt server. |
8 |
# usage:
|
9 |
# usrmgt-server <port> <magic>
|
|
10 |
||
432
by drtomc
usrmgt: more work on this. Still some work to go. |
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'] |
|
404
by drtomc
Version 0 of the usrmgt server. |
29 |
|
30 |
if __name__ == "__main__": |
|
31 |
port = int(sys.argv[1]) |
|
32 |
magic = sys.argv[2] |
|
33 |
||
432
by drtomc
usrmgt: more work on this. Still some work to go. |
34 |
common.chat.start_server(port, magic, False, create_user) |