Skip to content

Commit 3077356

Browse files
Fix issue where admins/m2m can't update challenge with groups
1 parent 0e1bae5 commit 3077356

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/services/ChallengeService.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,11 @@ async function ensureAccessibleByGroupsAccess (currentUser, challenge) {
8383
* @param {Object} data the challenge data to be updated
8484
* @param {String} challenge the original challenge data
8585
*/
86-
8786
async function ensureAcessibilityToModifiedGroups (currentUser, data, challenge) {
87+
const needToCheckForGroupAccess = !currentUser ? true : !currentUser.isMachine && !helper.hasAdminRole(currentUser)
88+
if (!needToCheckForGroupAccess) {
89+
return
90+
}
8891
const userGroups = await helper.getUserGroups(currentUser.userId)
8992
const userGroupsIds = _.map(userGroups, group => group.id)
9093
const updatedGroups = _.difference(_.union(challenge.groups, data.groups), _.intersection(challenge.groups, data.groups))

0 commit comments

Comments
 (0)