Commit b9429652 authored by Patrick Müller's avatar Patrick Müller

feat: do not allow users to delete their own user account

parent 5cacadc7
......@@ -2010,6 +2010,12 @@ class User implements QUI\Interfaces\Users\User
return;
}
if (QUI::getUserBySession()->getId() === $this->getId()) {
throw new QUI\Users\Exception(
QUI::getLocale()->get('quiqqer/quiqqer', 'exception.user_cannot_delete_himself')
);
}
if ($this->isSU()) {
$suUsers = QUI::getUsers()->getUserIds([
'where' => [
......
......@@ -1034,6 +1034,9 @@
Es muss mindestens ein Super-User im System vorhanden sein.
]]></de>
</locale>
<locale name="exception.user_cannot_delete_himself">
<de><![CDATA[Sie können Ihr eigenes Benutzerkonto nicht selbst löschen.]]></de>
</locale>
<locale name="exception.user.one.active.user.must.exists">
<de><![CDATA[
Der Benutzer kann nicht zerstört oder deaktiviert werden.
......
......@@ -1033,6 +1033,9 @@
There must be at least one active user in the system.
]]></en>
</locale>
<locale name="exception.user_cannot_delete_himself">
<en><![CDATA[You cannot delete your own user account.]]></en>
</locale>
<locale name="exception.site.linked.already.exists">
<en><![CDATA[
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment