]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
let hooks override standard user rights
authorEvan Prodromou <evan@status.net>
Thu, 17 Sep 2009 01:08:44 +0000 (21:08 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 28 Sep 2009 01:11:45 +0000 (21:11 -0400)
classes/User.php

index bea81af4d256950251b0bbc79fd407223e7b2db6..3f7ed09bb7ae508c324ebec07f436060d6f40ca1 100644 (file)
@@ -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;
     }
 }