Esempio n. 1
0
    def can_see_source(self, request, submission):
        # With ARCHIVE_USERCONTESTS=True observers can be regular users who were
        # once basicadmins - so disallow observers from seeing model solutions
        if not is_contest_admin(request) and is_model_submission(submission):
            return False

        return super(UserContestController, self).can_see_source(request, submission)
Esempio n. 2
0
    def can_see_source(self, request, submission):
        """Check if submission's source should be visible.
           :type submission: oioioi.contest.Submission

           Consider using filter_visible_sources instead, especially for batch
           queries.
        """
        qs = Submission.objects.filter(id=submission.id)
        if not (is_contest_admin(request) or is_contest_observer(request)) \
                and is_model_submission(submission):
            return False
        return self.filter_visible_sources(request, qs).exists()