Fix: We have to be able to remove delegations as well
This commit is contained in:
parent
324705aa90
commit
ab3f28f4c8
1 changed files with 11 additions and 9 deletions
|
@ -31,16 +31,18 @@ function delegate_post(App $a)
|
||||||
$parent_uid = defaults($_POST, 'parent_user', 0);
|
$parent_uid = defaults($_POST, 'parent_user', 0);
|
||||||
$parent_password = defaults($_POST, 'parent_password', '');
|
$parent_password = defaults($_POST, 'parent_password', '');
|
||||||
|
|
||||||
$user = dba::selectFirst('user', ['nickname'], ['uid' => $parent_uid]);
|
if ($parent_uid != 0) {
|
||||||
if (!DBM::is_result($user)) {
|
$user = dba::selectFirst('user', ['nickname'], ['uid' => $parent_uid]);
|
||||||
notice(L10n::t('Parent user not found.') . EOL);
|
if (!DBM::is_result($user)) {
|
||||||
return;
|
notice(L10n::t('Parent user not found.') . EOL);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$success = User::authenticate($user['nickname'], trim($parent_password));
|
$success = User::authenticate($user['nickname'], trim($parent_password));
|
||||||
if (!$success) {
|
if (!$success) {
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
notice(L10n::t('Permission denied.') . EOL);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dba::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]);
|
dba::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]);
|
||||||
|
|
Loading…
Reference in a new issue