Commit fd63159d authored by Yannis Barlas's avatar Yannis Barlas

fix(submission-form): admin is able to view own article's form

parent d304962f
......@@ -81,6 +81,8 @@ const getId = objectOrString => {
const permissions = {
// eslint-disable-next-line consistent-return
before: async (userId, operation, object, context) => {
if (operation === 'isGlobalAndNotAuthor') return false
const user = await context.models.User.find(userId)
if (user.admin) return true
},
......@@ -279,7 +281,7 @@ const permissions = {
const user = await context.models.User.find(getId(userId))
const global = await isGlobal(user, context)
const author = await isAuthor(user, object, context)
return global && !author
return (user.admin || global) && !author
},
isGlobalOrAcceptedReviewer: async (userId, operation, object, context) => {
const user = await context.models.User.find(getId(userId))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment