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

« back to all changes in this revision

Viewing changes to ivle/webapp/admin/subject.py

  • Committer: Matt Giuca
  • Date: 2010-02-12 04:00:39 UTC
  • Revision ID: matt.giuca@gmail.com-20100212040039-vw9yf8p4s98g6nu9
Added an argument 'config' to every single get_permissions method throughout the program. All calls to get_permissions pass a config. This is to allow per-site policy configurations on permissions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
253
253
        self.plugin_styles[TutorialPlugin] = ['tutorial.css']
254
254
        ctx['context'] = self.context
255
255
        ctx['req'] = req
256
 
        ctx['permissions'] = self.context.get_permissions(req.user)
 
256
        ctx['permissions'] = self.context.get_permissions(req.user,req.config)
257
257
        ctx['format_submission_principal'] = util.format_submission_principal
258
258
        ctx['format_datetime'] = ivle.date.make_date_nice
259
259
        ctx['format_datetime_short'] = ivle.date.format_datetime_for_paragraph
455
455
    The state must have an 'offering' attribute.
456
456
    """
457
457
    def _to_python(self, value, state):
458
 
        if ("enrol_" + value) not in state.offering.get_permissions(state.user):
 
458
        if (("enrol_" + value) not in
 
459
                state.offering.get_permissions(state.user, state.config)):
459
460
            raise formencode.Invalid('Not allowed to assign users that role',
460
461
                                     value, state)
461
462
        return value
505
506
 
506
507
        ctx['data'] = data or {}
507
508
        ctx['offering'] = self.context
508
 
        ctx['roles_auth'] = self.context.get_permissions(req.user)
 
509
        ctx['roles_auth'] = self.context.get_permissions(req.user, req.config)
509
510
        ctx['errors'] = errors
510
511
 
511
512
class OfferingProjectsView(XHTMLView):