def has_object_perm(self, auth, user, obj, method='GET'): perm = OrganizationPermission() request = Mock() request.auth = auth request.user = user request.method = method return perm.has_object_permission(request, None, obj)
def has_object_perm(self, auth, user, obj, method="GET"): perm = OrganizationPermission() request = Mock() request.auth = auth request.user = user request.method = method return perm.has_object_permission(request, None, obj)
def has_object_perm(self, method, obj, auth=None, user=None, is_superuser=None): perm = OrganizationPermission() 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) )
def has_object_perm(self, method, obj, auth=None, user=None, is_superuser=None): perm = OrganizationPermission() 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)