This commit is contained in:
mike12345567 2021-07-13 17:28:05 +01:00
parent 004f719dde
commit cc08b4fc4e
1 changed files with 3 additions and 1 deletions

View File

@ -73,7 +73,9 @@ exports.find = async function (ctx) {
const { userId, workspaceId } = ctx.query
if (workspaceId && userId) {
const workspace = await db.get(workspaceId)
const userInWorkspace = workspace.users.some(workspaceUser => workspaceUser === userId)
const userInWorkspace = workspace.users.some(
workspaceUser => workspaceUser === userId
)
if (!ctx.user.admin && !userInWorkspace) {
ctx.throw(400, `User is not in specified workspace: ${workspace}.`)
}