Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: allows admin to edit global credentials
Signed-off-by: Benjamin Gaussorgues <[email protected]>
  • Loading branch information
Altahrim authored and AndyScherzinger committed Jul 10, 2024
commit a631733d060a5bc3261344907c4f4114395894b5
12 changes: 9 additions & 3 deletions apps/files_external/lib/Controller/AjaxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,21 @@ public function getSshKeys($keyLength = 1024) {
*/
public function saveGlobalCredentials($uid, $user, $password) {
$currentUser = $this->userSession->getUser();
if ($currentUser === null) {
return false;
}

// Non-admins can only edit their own credentials
$allowedToEdit = ($currentUser->getUID() === $uid);
// Admin can edit global credentials
$allowedToEdit = $uid === ''
? $this->groupManager->isAdmin($currentUser->getUID())
: $currentUser->getUID() === $uid;

if ($allowedToEdit) {
$this->globalAuth->saveAuth($uid, $user, $password);
return true;
} else {
return false;
}

return false;
}
}