fix: #9085, dont prevent admins from deleting other users

v1.18.x
Barış Soner Uşaklı 4 years ago
parent ff2aa17bbc
commit 0f480be658

@ -107,6 +107,7 @@
"cant-ban-other-admins": "You can't ban other admins!",
"cant-remove-last-admin": "You are the only administrator. Add another user as an administrator before removing yourself as admin",
"account-deletion-disabled": "Account deletion is disabled",
"cant-delete-admin": "Remove administrator privileges from this account before attempting to delete it.",
"already-deleting": "Already deleting",

@ -250,8 +250,8 @@ async function processDeletion({ uid, method, password, caller }) {
const isSelf = parseInt(uid, 10) === caller.uid;
const isAdmin = await user.isAdministrator(caller.uid);
if (meta.config.allowAccountDelete !== 1) {
throw new Error('[[error:no-privileges]]');
if (isSelf && meta.config.allowAccountDelete !== 1) {
throw new Error('[[error:account-deletion-disabled]]');
} else if (!isSelf && !isAdmin) {
throw new Error('[[error:no-privileges]]');
} else if (isTargetAdmin) {

Loading…
Cancel
Save