Modify loadApps to always load all protected apps (Fixes #20756)
Adds a new AppManager method which identifies when all app types are protected, loads all apps (without checking user filters). This has the intended benefit of avoiding calls to User\Session:getUser() for these app types, and likely invalidating the session before user backends are loaded. Signed-off-by: Scott Shambarger <devel@shambarger.net>
This commit is contained in:
parent
1885d41460
commit
ff8695fdb4
|
@ -350,6 +350,21 @@ class AppManager implements IAppManager {
|
||||||
return !empty($protectedTypes);
|
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
|
* Enable an app only for specific groups
|
||||||
*
|
*
|
||||||
|
|
|
@ -110,8 +110,12 @@ class OC_App {
|
||||||
if ((bool) \OC::$server->getSystemConfig()->getValue('maintenance', false)) {
|
if ((bool) \OC::$server->getSystemConfig()->getValue('maintenance', false)) {
|
||||||
return 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
|
// Load the enabled apps here
|
||||||
$apps = self::getEnabledApps();
|
$apps = self::getEnabledApps(false, $all);
|
||||||
|
|
||||||
// Add each apps' folder as allowed class path
|
// Add each apps' folder as allowed class path
|
||||||
foreach ($apps as $app) {
|
foreach ($apps as $app) {
|
||||||
|
|
Loading…
Reference in New Issue