浏览代码

Merge pull request #46073 from nextcloud/fix/save_global_credentials

pull/46095/head
Benjamin Gaussorgues 2 周前
父节点
当前提交
369c552e41
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 9 次插入3 次删除
  1. 9
    3
      apps/files_external/lib/Controller/AjaxController.php

+ 9
- 3
apps/files_external/lib/Controller/AjaxController.php 查看文件

@@ -84,15 +84,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;
}
}

正在加载...
取消
保存