public function hasPermission($app, $perms = Horde_Perms::READ, array $params = array())
{
/* Always do isAuthenticated() check first. You can be an admin, but
* application auth != Horde admin auth. And there can *never* be
* non-SHOW access to an application that requires authentication. */
if (!$this->isAuthenticated(array('app' => $app, 'notransparent' => !empty($params['notransparent']))) && $GLOBALS['injector']->getInstance('Horde_Core_Factory_Auth')->create($app)->requireAuth() && $perms != Horde_Perms::SHOW) {
return false;
}
/* Otherwise, allow access for admins, for apps that do not have any
* explicit permissions, or for apps that allow the given permission. */
return $this->isAdmin() || ($GLOBALS['injector']->getInstance('Horde_Perms')->exists($app) ? $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission($app, $this->getAuth(), $perms) : (bool) $this->getAuth());
}