File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
apps/files_external/lib/Controller Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -106,15 +106,21 @@ public function getSshKeys($keyLength = 1024) {
106106 */
107107 public function saveGlobalCredentials ($ uid , $ user , $ password ) {
108108 $ currentUser = $ this ->userSession ->getUser ();
109+ if ($ currentUser === null ) {
110+ return false ;
111+ }
109112
110113 // Non-admins can only edit their own credentials
111- $ allowedToEdit = ($ currentUser ->getUID () === $ uid );
114+ // Admin can edit global credentials
115+ $ allowedToEdit = $ uid === ''
116+ ? $ this ->groupManager ->isAdmin ($ currentUser ->getUID ())
117+ : $ currentUser ->getUID () === $ uid ;
112118
113119 if ($ allowedToEdit ) {
114120 $ this ->globalAuth ->saveAuth ($ uid , $ user , $ password );
115121 return true ;
116- } else {
117- return false ;
118122 }
123+
124+ return false ;
119125 }
120126}
You can’t perform that action at this time.
0 commit comments