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) {
106
106
*/
107
107
public function saveGlobalCredentials ($ uid , $ user , $ password ) {
108
108
$ currentUser = $ this ->userSession ->getUser ();
109
+ if ($ currentUser === null ) {
110
+ return false ;
111
+ }
109
112
110
113
// 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 ;
112
118
113
119
if ($ allowedToEdit ) {
114
120
$ this ->globalAuth ->saveAuth ($ uid , $ user , $ password );
115
121
return true ;
116
- } else {
117
- return false ;
118
122
}
123
+
124
+ return false ;
119
125
}
120
126
}
You can’t perform that action at this time.
0 commit comments