From 5c6f6169a588110f9ccc9892eadeb431b737f571 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Fri, 22 Jan 2010 11:27:05 -0500 Subject: [PATCH] Add Horde_Registry#listAllApps Allow for listing of applications without regard to permissions. Needed to solve chicken-or-egg problem of setting up a new install, but admin/setup failing to load because of applications without configuration files. This broke when fixing Bug: 8475 when we check auth before checking isAdmin() --- framework/Core/lib/Horde/Registry.php | 24 ++++++++++++++++++++++-- horde/admin/setup/index.php | 2 +- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/framework/Core/lib/Horde/Registry.php b/framework/Core/lib/Horde/Registry.php index e5d692003..4e70ad5f2 100644 --- a/framework/Core/lib/Horde/Registry.php +++ b/framework/Core/lib/Horde/Registry.php @@ -555,6 +555,27 @@ class Horde_Registry } /** + * Return a list of all applications, ignoring permissions. + * + * @return array + */ + public function listAllApps($filter = null) + { + // Default to all installed (but possibly not configured) applications) + if (is_null($filter)) { + $filter = array('inactive', 'hidden', 'notoolbar', 'active', 'admin'); + } + $apps = array(); + foreach ($this->applications as $app => $params) { + if (in_array($params['status'], $filter)) { + $apps[] = $app; + } + } + + return $apps; + } + + /** * Returns all available registry APIs. * * @return array The API list. @@ -1121,8 +1142,7 @@ class Horde_Registry } /* Otherwise, allow access for admins, for apps that do not have any - * have any explicit permissions, or for apps that allow the given - * permission. */ + * explicit permissions, or for apps that allow the given permission. */ return Horde_Auth::isAdmin() || !$GLOBALS['perms']->exists($app) || $GLOBALS['perms']->hasPermission($app, Horde_Auth::getAuth(), $perms); diff --git a/horde/admin/setup/index.php b/horde/admin/setup/index.php index e1296967a..2ee9b03ae 100644 --- a/horde/admin/setup/index.php +++ b/horde/admin/setup/index.php @@ -94,7 +94,7 @@ $warning = Horde::img('alerts/warning.png'); $error = Horde::img('alerts/error.png'); $conf_url = Horde::applicationUrl('admin/setup/config.php'); -$a = $registry->listApps(array('inactive', 'hidden', 'notoolbar', 'active', 'admin')); +$a = $registry->listAllApps(); $apps = array(); $i = -1; if (file_exists(HORDE_BASE . '/lib/bundle.php')) { -- 2.11.0