~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-24 13:29:44 UTC
  • Revision ID: grantw@unimelb.edu.au-20090224132944-lm29zd1li1rjg77p
Privileges (apart from admin) are now offering-local, not global.

Offering privileges are granted by Enrolment.role, and global admin
by User.admin. ivle.caps is dead.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
# TODO Does not distinguish between current and past subjects.
25
25
 
26
 
from ivle import caps
27
26
from ivle.database import Subject
28
27
 
29
28
from ivle.webapp.base.plugins import ViewPlugin, MediaPlugin
46
45
        # Show a group panel per enrolment
47
46
        ctx['get_user_groups'] = req.user.get_groups
48
47
        ctx['enrolments'] = req.user.active_enrolments
 
48
 
 
49
        roles = set((e.role for e in req.user.active_enrolments))
49
50
        ctx['manage_subjects'] = req.store.find(Subject) if \
50
 
              req.user.hasCap(caps.CAP_MANAGEGROUPS) else []
 
51
              req.user.admin or 'tutor' in roles or 'lecturer' in roles else []
51
52
 
52
53
 
53
54
class Plugin(ViewPlugin, MediaPlugin):