Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.

Commit ae136e6

Browse files
committed
Allowing admin users to create releases on any game
1 parent a46ae47 commit ae136e6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/models/game.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,15 @@ GameSchema.methods.hasPermission = function(token, callback) {
437437
});
438438
})
439439
.then(function(groups) {
440+
// first, check if the user is an admin (by looking at their user group). If so, they should have permissions on
441+
// all games
442+
for (let i = 0; i < groups.length; i++) {
443+
if (groups[i].isUserGroup === true && groups[i].privilege === 2) {
444+
callback(null, game);
445+
return;
446+
}
447+
}
448+
440449
const ids = groups.map(group => group._id.toString());
441450
const gameGroups = game.groups.map(entry => {
442451
if (entry.group._id) {

0 commit comments

Comments
 (0)