let hooks override standard user rights

This commit is contained in:
Evan Prodromou 2009-09-16 21:08:44 -04:00
parent 6c069312e2
commit 38345d0783

View File

@ -726,15 +726,18 @@ class User extends Memcached_DataObject
function hasRight($right) function hasRight($right)
{ {
switch ($right) $result = false;
{ if (Event::handle('UserRightsCheck', array($this, $right, &$result))) {
case Right::deleteOthersNotice: switch ($right)
return $this->hasRole('moderator'); {
break; case Right::deleteOthersNotice:
default: $result = $this->hasRole('moderator');
$result = false; break;
Event::handle('UserRightsCheck', array($this, &$result)); default:
return $result; $result = false;
break;
}
} }
return $result;
} }
} }