From d3b00a3a2b09bc462a8da9ca655385b5b95bc33d Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Mon, 11 Aug 2014 17:14:56 -0400 Subject: [PATCH] Fix tournaments permissions Previously, ROs/leaders couldn't enable/start tournaments --- tournaments/index.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/tournaments/index.js b/tournaments/index.js index e082bd47b0..16c19f40fd 100644 --- a/tournaments/index.js +++ b/tournaments/index.js @@ -820,9 +820,7 @@ CommandParser.commands.tournament = function (paramString, room, user) { "More detailed help can be found here" ); } 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+")."); } }