32
32
# TODO: When creating a new home directory, chown it to its owner
44
def make_svn_repo(login):
45
"""Create a repository for the given user.
47
path = os.path.join(conf.svn_repo_path, login)
48
res = os.system("svnadmin create '%s'" % path)
50
raise Exception("Cannot create repository for %s" % login)
52
def make_svn_config(login):
53
"""Add an entry to the apache-svn config file for the given user.
55
f = open(conf.svn_conf, "a")
56
f.write("[%s:/]\n" % login)
57
f.write(" %s = rw\n" % login)
58
f.write(" @tutor = r\n")
59
f.write(" @lecturer = rw\n")
60
f.write(" @admin = rw\n")
64
def make_svn_auth(login):
65
"""Setup svn authentication for the given user.
66
FIXME: create local.auth entry
68
passwd = md5.new(uuid.uuid4().bytes).digest().encode('hex')
69
if os.path.exists(conf.svn_auth_ivle):
74
db.DB().update_user({'svn_pass':passwd})
76
res = os.system("htpasswd -%smb %s %s" % (create,
80
raise Exception("Unable to create ivle-auth for %s" % login)
42
82
def make_jail(username, uid, force=True):
43
83
"""Creates a new user's jail space, in the jail directory as configured in
166
206
raise Exception, errors
168
def make_user_db(login, uid, password, nick, fullname, rolenm, studentid,
208
def make_user_db(login, password, uid, email, nick, fullname, rolenm,
209
studentid, force=True):
170
210
"""Creates a user's entry in the database, filling in all the fields.
171
211
If force is False, throws an exception if the user already exists.
172
212
If True, overwrites the user's entry in the DB.
178
218
dbconn.delete_user(login)
181
dbconn.create_user(login, uid, password, nick, fullname, rolenm, studentid)
221
dbconn.create_user(login, password, uid, email, nick, fullname, rolenm,