1
0
Fork 0

Merge pull request #4588 from annando/delegate-zero

Fix: We have to be able to remove delegations as well
This commit is contained in:
Tobias Diekershoff 2018-03-12 07:53:46 +01:00 committed by GitHub
commit 03079acf79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,16 +31,18 @@ function delegate_post(App $a)
$parent_uid = defaults($_POST, 'parent_user', 0);
$parent_password = defaults($_POST, 'parent_password', '');
$user = dba::selectFirst('user', ['nickname'], ['uid' => $parent_uid]);
if (!DBM::is_result($user)) {
notice(L10n::t('Parent user not found.') . EOL);
return;
}
if ($parent_uid != 0) {
$user = dba::selectFirst('user', ['nickname'], ['uid' => $parent_uid]);
if (!DBM::is_result($user)) {
notice(L10n::t('Parent user not found.') . EOL);
return;
}
$success = User::authenticate($user['nickname'], trim($parent_password));
if (!$success) {
notice(L10n::t('Permission denied.') . EOL);
return;
$success = User::authenticate($user['nickname'], trim($parent_password));
if (!$success) {
notice(L10n::t('Permission denied.') . EOL);
return;
}
}
dba::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]);