mirror of
https://github.com/nextcloud/server.git
synced 2026-06-06 15:23:17 -04:00
Merge pull request #46090 from nextcloud/backport/46073/stable28
[stable28] fix: allows admin to edit global credentials
This commit is contained in:
commit
290ccdb684
1 changed files with 9 additions and 3 deletions
|
|
@ -106,15 +106,21 @@ class AjaxController extends Controller {
|
|||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue