Fix tournaments permissions

Previously, ROs/leaders couldn't enable/start tournaments
This commit is contained in:
Guangcong Luo 2014-08-11 17:14:56 -04:00
parent 4590deff58
commit d3b00a3a2b

View File

@ -820,9 +820,7 @@ CommandParser.commands.tournament = function (paramString, room, user) {
"More detailed help can be found <a href=\"https://gist.github.com/kotarou3/7872574\">here</a>"
);
} else if (cmd === 'on' || cmd === 'enable') {
if (!user.can('tournamentsmanagement')) {
return this.sendReply(cmd + " - Access denied.");
}
if (!this.can('tournamentsmanagement', null, room)) return;
if (room.toursEnabled) {
return this.sendReply("Tournaments are already enabled.");
}
@ -833,9 +831,7 @@ CommandParser.commands.tournament = function (paramString, room, user) {
}
return this.sendReply("Tournaments enabled.");
} else if (cmd === 'off' || cmd === 'disable') {
if (!user.can('tournamentsmanagement')) {
return this.sendReply(cmd + " - Access denied.");
}
if (!this.can('tournamentsmanagement', null, room)) return;
if (!room.toursEnabled) {
return this.sendReply("Tournaments are already disabled.");
}
@ -847,11 +843,9 @@ CommandParser.commands.tournament = function (paramString, room, user) {
return this.sendReply("Tournaments disabled.");
} else if (cmd === 'create' || cmd === 'new') {
if (room.toursEnabled) {
if (!user.can('tournaments', null, room)) {
return this.sendReply(cmd + " - Access denied.");
}
if (!this.can('tournaments', null, room)) return;
} else {
if (!user.can('tournamentsmanagement'), null, room) {
if (!user.can('tournamentsmanagement', null, room)) {
return this.sendReply("Tournaments are disabled in this room ("+room.id+").");
}
}