Use check_workspace_permission

This commit is contained in:
richard-dds 2018-09-06 11:49:57 -04:00
parent 40c141f146
commit 6c0df3b0cb

View File

@ -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