[FIX] Cannot deactive a regular user if there's only one admin

user admin check  at setUserActiveStatus
pull/23645/head
Duda Nogueira 4 years ago committed by Diego Sampaio
parent 65cb240247
commit 6dbd6aae66
No known key found for this signature in database
GPG Key ID: E060152B30502562
  1. 2
      app/lib/server/functions/setUserActiveStatus.js

@ -43,7 +43,7 @@ export function setUserActiveStatus(userId, active, confirmRelinquish = false) {
// Users without username can't do anything, so there is no need to check for owned rooms
if (user.username != null && !active) {
const userAdmin = Users.findOneAdmin(userId.count);
const userAdmin = Users.findOneAdmin(userId);
const adminsCount = Users.findActiveUsersInRoles(['admin']).count();
if (userAdmin && adminsCount === 1) {
throw new Meteor.Error('error-action-not-allowed', 'Leaving the app without an active admin is not allowed', {

Loading…
Cancel
Save