Use check_workspace_permission
This commit is contained in:
parent
40c141f146
commit
6c0df3b0cb
@ -30,10 +30,9 @@ class Workspaces(object):
|
|||||||
except NoResultFound:
|
except NoResultFound:
|
||||||
raise NotFoundError("workspace")
|
raise NotFoundError("workspace")
|
||||||
|
|
||||||
if not Authorization.has_workspace_permission(
|
Authorization.check_workspace_permission(
|
||||||
user, workspace, Permissions.VIEW_WORKSPACE
|
user, workspace, Permissions.VIEW_WORKSPACE, "get workspace"
|
||||||
):
|
)
|
||||||
raise UnauthorizedError(user, "get workspace")
|
|
||||||
|
|
||||||
return workspace
|
return workspace
|
||||||
|
|
||||||
@ -58,10 +57,9 @@ class Workspaces(object):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_with_members(cls, user, workspace_id):
|
def get_with_members(cls, user, workspace_id):
|
||||||
workspace = Workspaces.get(user, workspace_id)
|
workspace = Workspaces.get(user, workspace_id)
|
||||||
if not Authorization.has_workspace_permission(
|
Authorization.check_workspace_permission(
|
||||||
user, workspace, Permissions.VIEW_WORKSPACE_MEMBERS
|
user, workspace, Permissions.VIEW_WORKSPACE_MEMBERS, "view workspace members"
|
||||||
):
|
)
|
||||||
raise UnauthorizedError(user, "view workspace members")
|
|
||||||
return workspace
|
return workspace
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Loading…
x
Reference in New Issue
Block a user