aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/lib/Controller/AjaxController.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/files_external/lib/Controller/AjaxController.php b/apps/files_external/lib/Controller/AjaxController.php
index a03243020e4..0e43ea38eec 100644
--- a/apps/files_external/lib/Controller/AjaxController.php
+++ b/apps/files_external/lib/Controller/AjaxController.php
@@ -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;
}
}