Add rake task for making someone into an admin

This commit is contained in:
Eugen Rochko 2017-02-13 20:41:48 +01:00
parent 138d21aea8
commit fae1799646
2 changed files with 20 additions and 2 deletions

View File

@ -1,8 +1,16 @@
Administration guide Administration guide
================= ====================
So, you have a working Mastodon instance... now what? So, you have a working Mastodon instance... now what?
## Turning into an admin
The following rake task:
rails mastodon:make_admin USERNAME=alice
Would turn the local user "alice" into an admin.
## Administration web interface ## Administration web interface
A user that is designated as `admin = TRUE` in the database is able to access a suite of administration tools: A user that is designated as `admin = TRUE` in the database is able to access a suite of administration tools:
@ -20,6 +28,7 @@ Your site settings are stored in the `settings` database table, and editable thr
You are able to set the following settings: You are able to set the following settings:
- Site title
- Contact username - Contact username
- Contact email - Contact email
- Site description - Site description

View File

@ -1,6 +1,15 @@
# frozen_string_literal: true # frozen_string_literal: true
namespace :mastodon do namespace :mastodon do
task make_admin: :environment do
include RoutingHelper
user = Account.find_local(ENV.fetch('USERNAME')).user
user.update(admin: true)
puts "Congrats! #{user.account.username} is now an admin. \\o/\nNavigate to #{admin_settings_url} to get started"
end
namespace :media do namespace :media do
desc 'Removes media attachments that have not been assigned to any status for longer than a day' desc 'Removes media attachments that have not been assigned to any status for longer than a day'
task clear: :environment do task clear: :environment do