diff options
author | Evan Prodromou <evan@status.net> | 2009-09-16 21:08:44 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2009-09-27 21:11:45 -0400 |
commit | 38345d078343d4631eab2c883a39d87380f7b1af (patch) | |
tree | f7eba3e504edd6a2f3357c6dfe3f06f97257fc8a | |
parent | 6c069312e2911d3b2fe54d051354f579fde7bb63 (diff) |
let hooks override standard user rights
-rw-r--r-- | classes/User.php | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/classes/User.php b/classes/User.php index bea81af4d..3f7ed09bb 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; } } |