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

« back to all changes in this revision

Viewing changes to ivle/webapp/groups/__init__.py

  • Committer: William Grant
  • Date: 2009-02-27 04:47:06 UTC
  • Revision ID: grantw@unimelb.edu.au-20090227044706-w4infz8hr6ui3lve
SubjectsView is now only accessible by people associated with subjects.
GroupsView uses the offering's permission calculator.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    """
33
33
    template = 'template.html'
34
34
    tab = 'groups'
 
35
    permission = 'edit'
35
36
 
36
37
    def __init__(self, req, subject, year, semester):
37
38
        """Find the given offering by subject, year and semester."""
41
42
            Offering.semester_id == Semester.id,
42
43
            Semester.year == year,
43
44
            Semester.semester == semester).one()
44
 
        
 
45
 
45
46
        if not self.context:
46
47
            raise NotFound()
47
48
 
48
 
    def authorize(self, req):
49
 
        enrolment = self.context.get_enrolment(req.user)
50
 
        if not enrolment:
51
 
            return False
52
 
        return req.user.admin or enrolment.role in (u'tutor', u'lecturer')
53
 
 
54
49
    def populate(self, req, ctx):
55
50
        self.plugin_styles[Plugin] = ['groups.css']
56
51
        self.plugin_scripts[Plugin] = ['groups.js']