Example #1
0
    def has_list_permission(cls, request):
        try:

            return check_has_access(cls.has_access, request) or len(
                request.user.memberships.filter(
                    membership_type=MembershipType.LEADER))
        except AttributeError:
            return check_has_access(cls.has_access, request)
Example #2
0
 def has_object_write_permission(self, request):
     if request.method == "DELETE":
         return check_has_access(
             self.has_access,
             request,
         )
     return self == request.user or check_has_access(
         self.has_access,
         request,
     )
Example #3
0
 def has_retrieve_permission(cls, request):
     if request.user:
         return request.id == request._user.user_id or check_has_access(
             cls.has_access,
             request,
         )
     return check_has_access(
         cls.has_access,
         request,
     )
Example #4
0
 def has_update_permission(cls, request):
     try:
         if request.user:
             return request.user.user_id == request.parser_context[
                 "kwargs"]["pk"] or check_has_access(
                     cls.has_access,
                     request,
                 )
     except (AssertionError, KeyError):
         return check_has_access(
             cls.has_access,
             request,
         )
Example #5
0
 def has_object_retrieve_permission(self, request):
     return self == request.user or check_has_access(
         self.has_access,
         request,
     )
Example #6
0
 def has_write_permission(cls, request):
     return check_has_access(
         cls.has_access,
         request,
     )
Example #7
0
 def has_write_permission(cls, request):
     if not request.user:
         return False
     return check_has_access(cls.write_access, request)
Example #8
0
 def has_list_permission(cls, request):
     return check_has_access(cls.write_access, request)