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

« back to all changes in this revision

Viewing changes to ivle/database.py

  • Committer: William Grant
  • Date: 2009-07-05 07:54:29 UTC
  • mto: (1294.4.2 ui-the-third)
  • mto: This revision was merged to the branch mainline in revision 1353.
  • Revision ID: grantw@unimelb.edu.au-20090705075429-qyh9midyp0v73gnv
Add export details for the breadcrumb chevron SVG.

Show diffs side-by-side

added added

removed removed

Lines of Context:
234
234
        they may do everything. Otherwise they may do nothing.
235
235
        """
236
236
        if user and user.admin or user is self:
237
 
            return set(['view_public', 'view', 'edit', 'submit_project'])
 
237
            return set(['view', 'edit', 'submit_project'])
238
238
        else:
239
 
            return set(['view_public'])
 
239
            return set()
240
240
 
241
241
# SUBJECTS AND ENROLMENTS #
242
242
 
375
375
            if (enrolment and enrolment.role in (u'tutor', u'lecturer')) \
376
376
               or user.admin:
377
377
                perms.add('edit')
378
 
                # XXX Bug #493945 -- should tutors have these permissions?
379
 
                # Potentially move into the next category (lecturer & admin)
380
 
                perms.add('enrol')          # Can see enrolment screen at all
381
 
                perms.add('enrol_student')  # Can enrol students
382
 
            if (enrolment and enrolment.role in (u'lecturer')) or user.admin:
383
 
                perms.add('enrol_tutor')    # Can enrol tutors
384
 
            if user.admin:
385
 
                perms.add('enrol_lecturer') # Can enrol lecturers
386
378
        return perms
387
379
 
388
380
    def get_enrolment(self, user):
399
391
                Enrolment.user_id == User.id,
400
392
                Enrolment.offering_id == self.id,
401
393
                Enrolment.role == role
402
 
                ).order_by(User.login)
 
394
                )
403
395
 
404
396
    @property
405
397
    def students(self):
465
457
        return self.offering.get_permissions(user)
466
458
 
467
459
    @property
468
 
    def is_group(self):
469
 
        return self.max_students_per_group is not None
470
 
 
471
 
    @property
472
460
    def assigned(self):
473
461
        """Get the entities (groups or users) assigned to submit this project.
474
462
 
475
463
        This will be a Storm ResultSet.
476
464
        """
477
465
        #If its a solo project, return everyone in offering
478
 
        if self.is_group:
 
466
        if self.max_students_per_group is None:
 
467
            return self.offering.students
 
468
        else:
479
469
            return self.project_groups
480
 
        else:
481
 
            return self.offering.students
482
470
 
483
471
class Project(Storm):
484
472
    """A student project for which submissions can be made."""
990
978
    suite = Reference(suiteid, "TestSuite.suiteid")
991
979
    passmsg = Unicode()
992
980
    failmsg = Unicode()
993
 
    test_default = Unicode() # Currently unused - only used for file matching.
 
981
    test_default = Unicode()
994
982
    seq_no = Int()
995
983
 
996
984
    parts = ReferenceSet(testid, "TestCasePart.testid")