Project

General

Profile

Actions

Bug #7253

closed

unable to modify user in UI as it incorrectly states "Administrator cannot be removed from the last admin account"

Added by Thomas McKay over 10 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Authentication
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

The bit of code in app/model/user.rb ensure_last_admin_remains_admin()

!new_record? && admin_changed? && !admin && User.unscoped.only_admin.except_hidden.size <= 1

evaluates (incorrectly) to true.

User.unscoped.only_admin.except_hidden.size = 1

Why is more than one admin required?

Actions

Also available in: Atom PDF