Skip to content

Commit bd2c52e

Browse files
AltahrimAndyScherzinger
authored andcommitted
fix: allows admin to edit global credentials
Signed-off-by: Benjamin Gaussorgues <[email protected]>
1 parent d7ea479 commit bd2c52e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

apps/files_external/lib/Controller/AjaxController.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)