Skip to content

Commit 741361a

Browse files
resource role check
1 parent 0f41a8a commit 741361a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/common/helper.js

+12
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,18 @@ function * checkCreateAccess (authUser, subEntity) {
447447
const phases = challengeDetails.body.phases
448448
const winner = challengeDetails.body.winners
449449

450+
// Check if the User is assigned as the reviewer for the contest
451+
const reviewers = _.filter(currUserRoles, { role: 'Reviewer' })
452+
if (reviewers.length !== 0) {
453+
throw new errors.HttpStatusError(400, `You cannot create a submission for a challenge while you are a reviewer`)
454+
}
455+
456+
// Check if the User is assigned as the iterative reviewer for the contest
457+
const iterativeReviewers = _.filter(currUserRoles, { role: 'Iterative Reviewer' })
458+
if (iterativeReviewers.length !== 0) {
459+
throw new errors.HttpStatusError(400, `You cannot create a submission for a challenge while you are a iterative reviewer`)
460+
}
461+
450462
// Check if the User is registered for the contest
451463
const submitters = _.filter(currUserRoles, { role: 'Submitter' })
452464
if (submitters.length === 0) {

0 commit comments

Comments
 (0)