Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/common/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,18 @@ function * checkCreateAccess (authUser, subEntity) {
const phases = challengeDetails.body.phases
const winner = challengeDetails.body.winners

// Check if the User is assigned as the reviewer for the contest
const reviewers = _.filter(currUserRoles, { role: 'Reviewer' })
if (reviewers.length !== 0) {
throw new errors.HttpStatusError(400, `You cannot create a submission for a challenge while you are a reviewer`)
}

// Check if the User is assigned as the iterative reviewer for the contest
const iterativeReviewers = _.filter(currUserRoles, { role: 'Iterative Reviewer' })
if (iterativeReviewers.length !== 0) {
throw new errors.HttpStatusError(400, `You cannot create a submission for a challenge while you are an iterative reviewer`)
}

// Check if the User is registered for the contest
const submitters = _.filter(currUserRoles, { role: 'Submitter' })
if (submitters.length === 0) {
Expand Down