Fix: We have to be able to remove delegations as well

This commit is contained in:
Michael 2018-03-12 04:50:07 +00:00
parent 324705aa90
commit ab3f28f4c8

View file

@ -31,6 +31,7 @@ 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', '');
if ($parent_uid != 0) {
$user = dba::selectFirst('user', ['nickname'], ['uid' => $parent_uid]); $user = dba::selectFirst('user', ['nickname'], ['uid' => $parent_uid]);
if (!DBM::is_result($user)) { if (!DBM::is_result($user)) {
notice(L10n::t('Parent user not found.') . EOL); notice(L10n::t('Parent user not found.') . EOL);
@ -42,6 +43,7 @@ function delegate_post(App $a)
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()]);
} }