Exemplo n.º 1
0
 def has_object_perm(self, auth, user, obj, method='GET'):
     perm = ProjectPermission()
     request = Mock()
     request.auth = auth
     request.user = user
     request.method = method
     return perm.has_object_permission(request, None, obj)
Exemplo n.º 2
0
 def has_object_perm(self, method, obj, auth=None, user=None, is_superuser=None):
     perm = ProjectPermission()
     request = Mock()
     request.auth = auth
     request.user = user
     request.method = method
     request.is_superuser = lambda: is_superuser if is_superuser is not None else user.is_superuser
     return perm.has_object_permission(request, None, obj)
Exemplo n.º 3
0
 def has_object_perm(self, method, obj, auth=None, user=None, is_superuser=None):
     perm = ProjectPermission()
     request = self.make_request(user=user, auth=auth, method=method)
     if is_superuser:
         request.superuser.set_logged_in(request.user)
     return (
         perm.has_permission(request, None) and perm.has_object_permission(request, None, obj)
     )
Exemplo n.º 4
0
 def has_object_perm(self, method, obj, auth=None, user=None, is_superuser=None):
     perm = ProjectPermission()
     request = Mock()
     request.auth = auth
     request.user = user
     request.method = method
     request.is_superuser = lambda: is_superuser if is_superuser is not None else user.is_superuser
     return (
         perm.has_permission(request, None) and
         perm.has_object_permission(request, None, obj)
     )