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

« back to all changes in this revision

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

  • Committer: Matt Giuca
  • Date: 2010-02-12 02:49:17 UTC
  • Revision ID: matt.giuca@gmail.com-20100212024917-z9g1d5v4utr0u2zm
Fixed policy on who is able to view the list of exercises and create a new one. Rather than being 'if you can edit any offering', it is now the same rule as determining whether you can edit exercises.

Show diffs side-by-side

added added

removed removed

Lines of Context:
526
526
    template = 'templates/exercise_add.html'
527
527
    tab = 'subjects'
528
528
 
529
 
    #XXX: This should be done somewhere else
530
529
    def authorize(self, req):
531
 
        for offering in req.store.find(Offering):
532
 
            if 'edit' in offering.get_permissions(req.user):
533
 
                return True
534
 
        return False
535
 
        
 
530
        return 'edit' in ivle.database.Exercise.global_permissions(req.user)
 
531
 
536
532
    def populate(self, req, ctx):
537
533
        self.plugin_scripts[Plugin] = ['exercise_admin.js']
538
534
 
545
541
    breadcrumb_text = 'Exercises'
546
542
    tab = 'subjects'
547
543
 
548
 
    #XXX: This should be done somewhere else
549
544
    def authorize(self, req):
550
 
        for offering in req.store.find(Offering):
551
 
            if 'edit' in offering.get_permissions(req.user):
552
 
                return True
553
 
        return False
 
545
        return 'edit' in ivle.database.Exercise.global_permissions(req.user)
554
546
 
555
547
    def populate(self, req, ctx):
556
548
        self.plugin_styles[Plugin] = ['exercise_admin.css']