Skip to content

Commit 3d40d40

Browse files
Merge pull request #274 from topcoder-platform/issue_reviewer_role
reviewer role restriction
2 parents fd8d005 + 7a8fb4a commit 3d40d40

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/common/helper.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,18 @@ function * checkCreateAccess (authUser, subEntity) {
453453
// Get phases and winner detail from challengeDetails
454454
const phases = challengeDetails.body.phases
455455

456+
// Check if the User is assigned as the reviewer for the contest
457+
const reviewers = _.filter(currUserRoles, { role: 'Reviewer' })
458+
if (reviewers.length !== 0) {
459+
throw new errors.HttpStatusError(400, `You cannot create a submission for a challenge while you are a reviewer`)
460+
}
461+
462+
// Check if the User is assigned as the iterative reviewer for the contest
463+
const iterativeReviewers = _.filter(currUserRoles, { role: 'Iterative Reviewer' })
464+
if (iterativeReviewers.length !== 0) {
465+
throw new errors.HttpStatusError(400, `You cannot create a submission for a challenge while you are a iterative reviewer`)
466+
}
467+
456468
// Check if the User is registered for the contest
457469
const submitters = _.filter(currUserRoles, { role: 'Submitter' })
458470
if (submitters.length === 0) {

0 commit comments

Comments
 (0)