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

« back to all changes in this revision

Viewing changes to ivle/makeuser.py

  • Committer: Matt Giuca
  • Date: 2009-04-28 10:38:03 UTC
  • Revision ID: matt.giuca@gmail.com-20090428103803-ya5ehnz77bocj6ik
ivle.makeuser: rebuild_svn_config and rebuild_svn_group_config now require a
    'config' argument.
usrmgt-server: Supplies it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
 
75
75
    chown_to_webserver(path)
76
76
 
77
 
def rebuild_svn_config(store):
 
77
def rebuild_svn_config(store, config):
78
78
    """Build the complete SVN configuration file.
 
79
    @param config: An ivle.config.Config object.
79
80
    """
80
81
    users = store.find(ivle.database.User)
81
82
    groups = {}
82
83
    # TODO: Populate groups with per-offering tutors/lecturers/etc.
83
 
    f = open(ivle.conf.svn_conf + ".new", "w")
 
84
    conf_name = config['paths']['svn']['conf']
 
85
    temp_name = conf_name + ".new"
 
86
    f = open(temp_name, "w")
84
87
    f.write("# IVLE SVN Repositories Configuration\n")
85
88
    f.write("# Auto-generated on %s\n" % time.asctime())
86
89
    f.write("\n")
96
99
        #f.write("@admin = rw\n")
97
100
        f.write("\n")
98
101
    f.close()
99
 
    os.rename(ivle.conf.svn_conf + ".new", ivle.conf.svn_conf)
100
 
    chown_to_webserver(ivle.conf.svn_conf)
 
102
    os.rename(temp_name, conf_name)
 
103
    chown_to_webserver(conf_name)
101
104
 
102
 
def rebuild_svn_group_config(store):
 
105
def rebuild_svn_group_config(store, config):
103
106
    """Build the complete SVN configuration file for groups
 
107
    @param config: An ivle.config.Config object.
104
108
    """
105
 
    f = open(ivle.conf.svn_group_conf + ".new", "w")
 
109
    conf_name = config['paths']['svn']['group_conf']
 
110
    temp_name = conf_name + ".new"
 
111
    f = open(temp_name, "w")
106
112
    f.write("# IVLE SVN Group Repositories Configuration\n")
107
113
    f.write("# Auto-generated on %s\n" % time.asctime())
108
114
    f.write("\n")
117
123
            f.write("%s = rw\n" % user.login)
118
124
        f.write("\n")
119
125
    f.close()
120
 
    os.rename(ivle.conf.svn_group_conf + ".new", ivle.conf.svn_group_conf)
121
 
    chown_to_webserver(ivle.conf.svn_group_conf)
 
126
    os.rename(temp_name, conf_name)
 
127
    chown_to_webserver(conf_name)
122
128
 
123
129
def make_svn_auth(store, login, throw_on_error=True):
124
130
    """Setup svn authentication for the given user.