diff options
-rwxr-xr-x | config/config.sample.php | 6 | ||||
-rwxr-xr-x | lib/private/util.php | 14 |
2 files changed, 16 insertions, 4 deletions
diff --git a/config/config.sample.php b/config/config.sample.php index 59e1f3890ce..e613609bcef 100755 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -74,7 +74,11 @@ $CONFIG = array( /* URL to the parent directory of the 3rdparty directory, as seen by the browser */ "3rdpartyurl" => "", -/* Default app to load on login */ +/* Default app to open on login. + * This can be a comma-separated list of app ids. + * If the first app is not enabled for the current user, + * it will try with the second one and so on. If no enabled app could be found, + * the "files" app will be displayed instead. */ "defaultapp" => "files", /* Enable the help menu item in the settings */ diff --git a/lib/private/util.php b/lib/private/util.php index 424c27e74a7..e9e081a48fd 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -827,9 +827,17 @@ class OC_Util { if ($defaultPage) { $location = $urlGenerator->getAbsoluteURL($defaultPage); } else { - $defaultApp = \OCP\Config::getSystemValue('defaultapp', 'files'); - $defaultApp = OC_App::cleanAppId(strip_tags($defaultApp)); - $location = $urlGenerator->getAbsoluteURL('/index.php/apps/' . $defaultApp); + $appId = 'files'; + $defaultApps = explode(',', \OCP\Config::getSystemValue('defaultapp', 'files')); + // find the first app that is enabled for the current user + foreach ($defaultApps as $defaultApp) { + $defaultApp = OC_App::cleanAppId(strip_tags($defaultApp)); + if (OC_App::isEnabled($defaultApp)) { + $appId = $defaultApp; + break; + } + } + $location = $urlGenerator->linkTo($appId, 'index.php'); } } OC_Log::write('core', 'redirectToDefaultPage: '.$location, OC_Log::DEBUG); |