* </pre>
*
* @return boolean Whether or not the user is authenticated.
+ * @throws Horde_Auth_Exception
*/
static public function isAuthenticated($options = array())
{
}
/**
+ * Checks if an application requires additional authentication above and
+ * beyond Horde authentication.
+ *
+ * @params string $app The application to check.
+ *
+ * @return boolean Whether or not the application required additional
+ * authentication.
+ * @throws Horde_Auth_Exception
+ */
+ static public function requireAuth($app)
+ {
+ if ($app == 'horde') {
+ return false;
+ }
+
+ $app_auth = self::singleton('application', array('app' => $app));
+ return $app_auth->requireAuth();
+ }
+
+ /**
* Check existing auth for triggers that might invalidate it.
*
* @return boolean Is existing auth valid?
public function hasPermission($app, $perms = PERMS_READ)
{
/* Always do isAuthenticated() check first. You can be an admin, but
- * application auth != Horde admin auth. */
- if (!Horde_Auth::isAuthenticated(array('app' => $app))) {
- /* There can *never* be non-SHOW access to an application that
- * requires authentication. */
- $app_auth = Horde_Auth::singleton('application', array('app' => $app));
- if ($app_auth->requireAuth() && ($perms != PERMS_SHOW)) {
- return false;
- }
+ * application auth != Horde admin auth. And there can *never* be
+ * non-SHOW access to an application that requires authentication. */
+ if (!Horde_Auth::isAuthenticated(array('app' => $app)) &&
+ Horde_Auth::requireAuth($app) &&
+ ($perms != PERMS_SHOW)) {
+ return false;
}
/* Otherwise, allow access for admins, for apps that do not have any