Exemple #1
0
 def has_object_permission(self, request, view, obj):
     if request.user.username in \
             Quest.get_moderators(owner_username=obj) or \
             request.user.username == obj or request.user.username in \
             Mission.get_moderators(owner_username=obj):
         return True
     else:
         return False
Exemple #2
0
 def test_get_moderators(self):
     self.quest.moderators.connect(self.owner)
     cache.clear()
     res = Mission.get_moderators(self.mission.owner_username)
     self.assertIn(self.owner.username, res)