diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index f756664e45..40b329d249 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -350,6 +350,21 @@ class AppManager implements IAppManager { return !empty($protectedTypes); } + /** + * Whether a list of types contains only protected app types + * + * @param string[] $types + * @return bool + */ + public function hasOnlyProtectedAppTypes($types) { + if (empty($types)) { + return false; + } + + $unprotectedTypes = array_diff($types, $this->protectedAppTypes); + return empty($unprotectedTypes); + } + /** * Enable an app only for specific groups * diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index 2454d6be4f..23712312e1 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -110,8 +110,12 @@ class OC_App { if ((bool) \OC::$server->getSystemConfig()->getValue('maintenance', false)) { return false; } + // If only protected types, don't filter by user (prevents + // session invalidation when loading prelogin/authentication + // types). + $all = \OC::$server->getAppManager()->hasOnlyProtectedAppTypes($types); // Load the enabled apps here - $apps = self::getEnabledApps(); + $apps = self::getEnabledApps(false, $all); // Add each apps' folder as allowed class path foreach ($apps as $app) {