Fix events manager eroneous notification availability detection

This commit is contained in:
Romain Neutron
2013-11-08 18:24:17 +01:00
parent bea211074b
commit 866a3e94e0
15 changed files with 57 additions and 46 deletions

View File

@@ -178,21 +178,18 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract
}
/**
* @param integer $usr_id The id of the user to check
*
* @return boolean
*/
public function is_available()
public function is_available($usr_id)
{
$bool = false;
if ( ! $this->app['authentication']->isAuthenticated()) {
try {
$user = \User_Adapter::getInstance($usr_id, $this->app);
} catch (\Exception $e) {
return false;
}
if ($this->app['authentication']->getUser()->ACL()->has_right('push')) {
$bool = true;
}
return $bool;
return $user->ACL()->has_right('push');
}
}