From: Evan Prodromou Date: Thu, 17 Sep 2009 01:08:44 +0000 (-0400) Subject: let hooks override standard user rights X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=38345d078343d4631eab2c883a39d87380f7b1af;p=quix0rs-gnu-social.git let hooks override standard user rights --- 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; } }