@@ -104,6 +104,7 @@ public function __construct(string $appName,
104104 */
105105 protected function getUserData (string $ userId , bool $ includeScopes = false ): array {
106106 $ currentLoggedInUser = $ this ->userSession ->getUser ();
107+ assert ($ currentLoggedInUser !== null , 'No user logged in ' );
107108
108109 $ data = [];
109110
@@ -113,8 +114,8 @@ protected function getUserData(string $userId, bool $includeScopes = false): arr
113114 throw new OCSNotFoundException ('User does not exist ' );
114115 }
115116
116- // Should be at least Admin Or SubAdmin!
117- if ($ this -> groupManager -> isAdmin ( $ currentLoggedInUser -> getUID ())
117+ $ isAdmin = $ this -> groupManager -> isAdmin ( $ currentLoggedInUser -> getUID ());
118+ if ($ isAdmin
118119 || $ this ->groupManager ->getSubAdmin ()->isUserAccessible ($ currentLoggedInUser , $ targetUserObject )) {
119120 $ data ['enabled ' ] = $ this ->config ->getUserValue ($ targetUserObject ->getUID (), 'core ' , 'enabled ' , 'true ' ) === 'true ' ;
120121 } else {
@@ -132,13 +133,15 @@ protected function getUserData(string $userId, bool $includeScopes = false): arr
132133 $ gids [] = $ group ->getGID ();
133134 }
134135
135- try {
136- # might be thrown by LDAP due to handling of users disappears
137- # from the external source (reasons unknown to us)
138- # cf. https://github.com/nextcloud/server/issues/12991
139- $ data ['storageLocation ' ] = $ targetUserObject ->getHome ();
140- } catch (NoUserException $ e ) {
141- throw new OCSNotFoundException ($ e ->getMessage (), $ e );
136+ if ($ isAdmin ) {
137+ try {
138+ # might be thrown by LDAP due to handling of users disappears
139+ # from the external source (reasons unknown to us)
140+ # cf. https://github.com/nextcloud/server/issues/12991
141+ $ data ['storageLocation ' ] = $ targetUserObject ->getHome ();
142+ } catch (NoUserException $ e ) {
143+ throw new OCSNotFoundException ($ e ->getMessage (), $ e );
144+ }
142145 }
143146
144147 // Find the data
0 commit comments