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

« back to all changes in this revision

Viewing changes to ivle/makeuser.py

  • Committer: Matt Giuca
  • Date: 2009-12-01 04:21:28 UTC
  • mfrom: (1164.1.1 new-file-ui)
  • Revision ID: matt.giuca@gmail.com-20091201042128-e221i1fwpbpegj4f
Added hover styles for the file browser listing (merge from new-file-ui branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
                    User.login,
103
103
                    User.id == Enrolment.user_id,
104
104
                    Enrolment.offering_id == offeringid,
105
 
                    Enrolment.role.is_in((u'tutor', u'lecturer')),
106
 
                    Enrolment.active == True,
 
105
                    Enrolment.role.is_in((u'tutor', u'lecturer'))
107
106
                )
108
107
            )
109
108
 
186
185
                    User.login,
187
186
                    User.id == Enrolment.user_id,
188
187
                    Enrolment.offering_id == offeringid,
189
 
                    Enrolment.role.is_in((u'tutor', u'lecturer')),
190
 
                    Enrolment.active == True,
 
188
                    Enrolment.role.is_in((u'tutor', u'lecturer'))
191
189
                )
192
190
            )
193
191
 
213
211
    """
214
212
    # filename is, eg, /var/lib/ivle/svn/ivle.auth
215
213
    filename = config['paths']['svn']['auth_ivle']
 
214
    passwd = hashlib.md5(uuid.uuid4().bytes).hexdigest()
216
215
    if os.path.exists(filename):
217
216
        create = ""
218
217
    else:
219
218
        create = "c"
220
219
 
221
220
    user = User.get_by_login(store, login)
222
 
 
223
 
    if user.svn_pass is None:
224
 
        passwd = hashlib.md5(uuid.uuid4().bytes).hexdigest()
225
 
        user.svn_pass = unicode(passwd)
 
221
    user.svn_pass = unicode(passwd)
226
222
 
227
223
    res = subprocess.call(['htpasswd', '-%smb' % create,
228
 
                           filename, login, user.svn_pass])
 
224
                           filename, login, passwd])
229
225
    if res != 0 and throw_on_error:
230
226
        raise Exception("Unable to create ivle-auth for %s" % login)
231
227
 
233
229
    if create == "c":
234
230
        chown_to_webserver(filename)
235
231
 
236
 
    return user.svn_pass
 
232
    return passwd
237
233
 
238
234
def make_jail(user, config, force=True):
239
235
    """Create or update a user's jail.
271
267
        # User jail already exists. Blow it away but preserve their home
272
268
        # directory. It should be all that is there anyway, but you never
273
269
        # know!
274
 
        # Ignore warnings about the use of tempnam
 
270
        # Ignore warnings about the use of tmpnam
275
271
        warnings.simplefilter('ignore')
276
272
        homebackup = os.tempnam(tempdir)
277
273
        warnings.resetwarnings()