about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-02-13 20:41:48 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-02-13 20:42:02 +0100
commitfae1799646e752235123a981a1ca27c4070ebb5f (patch)
treec0d995bd72af3d5ed53c37a30ddd2751f3dd09b5
parent138d21aea84c376fea0100580f11cbf2b500914d (diff)
Add rake task for making someone into an admin
-rw-r--r--docs/Running-Mastodon/Administration-guide.md13
-rw-r--r--lib/tasks/mastodon.rake9
2 files changed, 20 insertions, 2 deletions
diff --git a/docs/Running-Mastodon/Administration-guide.md b/docs/Running-Mastodon/Administration-guide.md
index 1b9dc8630..af78f6235 100644
--- a/docs/Running-Mastodon/Administration-guide.md
+++ b/docs/Running-Mastodon/Administration-guide.md
@@ -1,8 +1,16 @@
 Administration guide
-=================
+====================
 
 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
 
 A user that is designated as `admin = TRUE` in the database is able to access a suite of administration tools:
@@ -20,9 +28,10 @@ Your site settings are stored in the `settings` database table, and editable thr
 
 You are able to set the following settings:
 
+- Site title
 - Contact username
 - Contact email
 - Site description
 - Site extended description
 
-You may wish to use the extended description (shown at https://yourmastodon.instance/about/more ) to display content guidelines or a user agreement (see https://mastodon.social/about/more for an example).
\ No newline at end of file
+You may wish to use the extended description (shown at https://yourmastodon.instance/about/more ) to display content guidelines or a user agreement (see https://mastodon.social/about/more for an example).
diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake
index 1b60bd1c9..8482d4124 100644
--- a/lib/tasks/mastodon.rake
+++ b/lib/tasks/mastodon.rake
@@ -1,6 +1,15 @@
 # frozen_string_literal: true
 
 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
     desc 'Removes media attachments that have not been assigned to any status for longer than a day'
     task clear: :environment do