aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/legacy/OC_Util.php
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-08-04 15:07:32 +0200
committerJulius Härtl <jus@bitgrid.net>2020-08-05 17:03:38 +0200
commitdb86bea18ce41ad73e9c1a06f2b2d89d8d4f2ef8 (patch)
tree1d2743d10b609763e94fb718ab85e84a0e4f684a /lib/private/legacy/OC_Util.php
parent7e2ded5a79b5be853671ba5bad2c84bc623f84a0 (diff)
downloadnextcloud-server-db86bea18ce41ad73e9c1a06f2b2d89d8d4f2ef8.tar.gz
nextcloud-server-db86bea18ce41ad73e9c1a06f2b2d89d8d4f2ef8.zip
Allow default app to be overwritten by user config
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/legacy/OC_Util.php')
-rw-r--r--lib/private/legacy/OC_Util.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php
index 410acbce698..9c92322da9e 100644
--- a/lib/private/legacy/OC_Util.php
+++ b/lib/private/legacy/OC_Util.php
@@ -68,6 +68,7 @@ use OCP\IConfig;
use OCP\IGroupManager;
use OCP\ILogger;
use OCP\IUser;
+use OCP\IUserSession;
class OC_Util {
public static $scripts = [];
@@ -1088,6 +1089,8 @@ class OC_Util {
* @suppress PhanDeprecatedFunction
*/
public static function getDefaultPageUrl() {
+ /** @var IConfig $config */
+ $config = \OC::$server->get(IConfig::class);
$urlGenerator = \OC::$server->getURLGenerator();
// Deny the redirect if the URL contains a @
// This prevents unvalidated redirects like ?redirect_url=:user@domain.com
@@ -1098,9 +1101,18 @@ class OC_Util {
if ($defaultPage) {
$location = $urlGenerator->getAbsoluteURL($defaultPage);
} else {
+
$appId = 'files';
- $config = \OC::$server->getConfig();
- $defaultApps = explode(',', $config->getSystemValue('defaultapp', 'dashboard'));
+ $defaultApps = explode(',', $config->getSystemValue('defaultapp', 'dashboard,files'));
+
+ /** @var IUserSession $userSession */
+ $userSession = \OC::$server->get(IUserSession::class);
+ $user = $userSession->getUser();
+ if ($user) {
+ $userDefaultApps = explode(',', $config->getUserValue($user->getUID(), 'core', 'defaultapp'));
+ $defaultApps = array_filter(array_merge($userDefaultApps, $defaultApps));
+ }
+
// find the first app that is enabled for the current user
foreach ($defaultApps as $defaultApp) {
$defaultApp = OC_App::cleanAppId(strip_tags($defaultApp));