One admin can't revoke another admin

AI-generated summary

The discussion centers around the inability for one admin to revoke another admin’s rights in Discourse. Ed_Bobkov discovered that after revoking admin status, the affected admin could regain it simply by logging back in. The root cause, identified by IAmGav, is the DISCOURSE_DEVELOPER_EMAILS setting in app.yml, which grants permanent admin rights to any email address listed there. … hellekin found a workaround using the Rails console to manually set u.admin = false and u.revoke_admin!, but noted continued access to the Staff category required further console commands. JammyDodger confirmed that self-demotion through the UI is impossible, requiring either console access or assistance from another admin, and emphasized that removing oneself from DISCOURSE_DEVELOPER_EMAILS prevents automatic re-promotion.

I have 2 admin accounts. Here is what I did. I logged in as a 1st admin, revoked the admin rights of the 2nd admin. Status changed to “Admin? No”. Then I logged in with this 2nd account in ‘incognito’ mode. Admin status changed back himself. What may be a reason for this? Thank you!

There is an admin email address in your config file (app.yml)

The setting is called

DISCOURSE_DEVELOPER_EMAILS:

That admin with that specific email address, will always have admin rights even if others try to remove it.

I have removed myself from DISCOURSE_DEVELOPER_EMAILS, then the UI did not provide “Revoke admin” for myself. I find this problematic that an admin cannot step down.

So I went to the console and ran in the rails console:

u = User.find(1)
u.admin = false
u.save

Is this correct?

I found that I could still post in the Staff category. So I added:

u.revoke_admin!

And now I’m a normal user. :partying_face:

Yes, it’s not possible to demote yourself. You’d either need to do it from the console, or ask one of the other site admins to do it through the UI as normal.

As long as you’re not in the DISCOURSE_DEVELOPER_EMAILS anymore you shouldn’t be re-promoted when you log out/login.