6868use OCP \IGroupManager ;
6969use OCP \ILogger ;
7070use OCP \IUser ;
71+ use OCP \IUserSession ;
7172
7273class OC_Util {
7374 public static $ scripts = [];
@@ -1088,6 +1089,8 @@ public static function checkAdminUser() {
10881089 * @suppress PhanDeprecatedFunction
10891090 */
10901091 public static function getDefaultPageUrl () {
1092+ /** @var IConfig $config */
1093+ $ config = \OC ::$ server ->get (IConfig::class);
10911094 $ urlGenerator = \OC ::$ server ->getURLGenerator ();
10921095 // Deny the redirect if the URL contains a @
10931096 // This prevents unvalidated redirects like ?redirect_url=:user@domain.com
@@ -1098,9 +1101,18 @@ public static function getDefaultPageUrl() {
10981101 if ($ defaultPage ) {
10991102 $ location = $ urlGenerator ->getAbsoluteURL ($ defaultPage );
11001103 } else {
1104+
11011105 $ appId = 'files ' ;
1102- $ config = \OC ::$ server ->getConfig ();
1103- $ defaultApps = explode (', ' , $ config ->getSystemValue ('defaultapp ' , 'dashboard ' ));
1106+ $ defaultApps = explode (', ' , $ config ->getSystemValue ('defaultapp ' , 'dashboard,files ' ));
1107+
1108+ /** @var IUserSession $userSession */
1109+ $ userSession = \OC ::$ server ->get (IUserSession::class);
1110+ $ user = $ userSession ->getUser ();
1111+ if ($ user ) {
1112+ $ userDefaultApps = explode (', ' , $ config ->getUserValue ($ user ->getUID (), 'core ' , 'defaultapp ' ));
1113+ $ defaultApps = array_filter (array_merge ($ userDefaultApps , $ defaultApps ));
1114+ }
1115+
11041116 // find the first app that is enabled for the current user
11051117 foreach ($ defaultApps as $ defaultApp ) {
11061118 $ defaultApp = OC_App::cleanAppId (strip_tags ($ defaultApp ));
0 commit comments