From c82eea234f519a9fc2836c8ed6e44f99f44940fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sat, 22 Jun 2013 17:42:41 +0200 Subject: [PATCH] Allow creating a local suspension when only the global permission is set --- file/lib/system/command/AbstractSuspensionCommand.class.php | 4 +++- .../system/command/AbstractUnsuspensionCommand.class.php | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/file/lib/system/command/AbstractSuspensionCommand.class.php b/file/lib/system/command/AbstractSuspensionCommand.class.php index d55df8d..ee53f76 100644 --- a/file/lib/system/command/AbstractSuspensionCommand.class.php +++ b/file/lib/system/command/AbstractSuspensionCommand.class.php @@ -91,7 +91,9 @@ public function checkPermission() { $this->room = $this->commandHandler->getRoom(); $ph = new \chat\system\permission\PermissionHandler(); - if (!$ph->getPermission($this->room, 'mod.can'.ucfirst((static::IS_GLOBAL ? 'g' : '').static::SUSPENSION_TYPE))) throw new \wcf\system\exception\PermissionDeniedException(); + if (!$ph->getPermission($this->room, 'mod.can'.ucfirst((static::IS_GLOBAL ? 'g' : '').static::SUSPENSION_TYPE)) && $ph->getPermission($this->room, 'mod.canG'.static::SUSPENSION_TYPE)) { + throw new \wcf\system\exception\PermissionDeniedException(); + } } /** diff --git a/file/lib/system/command/AbstractUnsuspensionCommand.class.php b/file/lib/system/command/AbstractUnsuspensionCommand.class.php index 4c5fecf..9520eac 100644 --- a/file/lib/system/command/AbstractUnsuspensionCommand.class.php +++ b/file/lib/system/command/AbstractUnsuspensionCommand.class.php @@ -57,10 +57,12 @@ public function executeAction() { */ public function checkPermission() { parent::checkPermission(); - + $this->room = $this->commandHandler->getRoom(); $ph = new \chat\system\permission\PermissionHandler(); - if (!$ph->getPermission($this->room, 'mod.can'.ucfirst((static::IS_GLOBAL ? 'g' : '').static::SUSPENSION_TYPE))) throw new \wcf\system\exception\PermissionDeniedException(); + if (!$ph->getPermission($this->room, 'mod.can'.ucfirst((static::IS_GLOBAL ? 'g' : '').static::SUSPENSION_TYPE)) && $ph->getPermission($this->room, 'mod.canG'.static::SUSPENSION_TYPE)) { + throw new \wcf\system\exception\PermissionDeniedException(); + } } /**