How to revert a users admin status? [solved]

web rails mastodon:make_admin USERNAME=alice makes a user admin, but now I want to remove user as admin. But I can’t find a web rails mastodon:remove_admin USERNAME=alice or similar.

So, how to revert a users admin status?

Open Rails console (rails c) and execute the following Ruby code:

Account.find_local('alice').user.update(admin: false)

rails c (or rails console) doesn’t seem to work on my instance.

I get a weird error with the Gemfile :
mastodon@shelter:~/live$ rails console

[!] There was an error parsing `Gemfile`: no implicit conversion of Symbol into Integer. Bundler cannot continue.

 #  from /home/mastodon/live/Gemfile:4
 #  -------------------------------------------
 #  source ''
 >  ruby '>= 2.3.0', '< 2.5.0'
 #  -------------------------------------------

mastodon@shelter:~/live$ ruby --version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

How to fix that so I can get into rails console ? (sorry, I’m really not used to ruby/rails)

Probably RAILS_ENV=production bundle exec rails c is what you want to do


Ah, thank you so much, it works much better this way indeed. :slight_smile: