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