From 38345d078343d4631eab2c883a39d87380f7b1af Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 16 Sep 2009 21:08:44 -0400 Subject: [PATCH] let hooks override standard user rights --- classes/User.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/classes/User.php b/classes/User.php index bea81af4d2..3f7ed09bb7 100644 --- a/classes/User.php +++ b/classes/User.php @@ -726,15 +726,18 @@ class User extends Memcached_DataObject function hasRight($right) { - switch ($right) - { - case Right::deleteOthersNotice: - return $this->hasRole('moderator'); - break; - default: - $result = false; - Event::handle('UserRightsCheck', array($this, &$result)); - return $result; + $result = false; + if (Event::handle('UserRightsCheck', array($this, $right, &$result))) { + switch ($right) + { + case Right::deleteOthersNotice: + $result = $this->hasRole('moderator'); + break; + default: + $result = false; + break; + } } + return $result; } } -- 2.39.5