From 44b2ee3485ba0845e5910cefcb4b1e2f84f34470 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 5 Jul 2022 02:41:40 +0200 Subject: Add customizable user roles (#18641) * Add customizable user roles * Various fixes and improvements * Add migration for old settings and fix tootctl role management --- config/routes.rb | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'config/routes.rb') diff --git a/config/routes.rb b/config/routes.rb index 4abf55655..177c1cff4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,7 +10,7 @@ Rails.application.routes.draw do get 'health', to: 'health#show' - authenticate :user, lambda { |u| u.admin? } do + authenticate :user, lambda { |u| u.role&.can?(:view_devops) } do mount Sidekiq::Web, at: 'sidekiq', as: :sidekiq mount PgHero::Engine, at: 'pghero', as: :pghero end @@ -295,17 +295,11 @@ Rails.application.routes.draw do post :resend end end - - resource :role, only: [] do - member do - post :promote - post :demote - end - end end resources :users, only: [] do - resource :two_factor_authentication, only: [:destroy] + resource :two_factor_authentication, only: [:destroy], controller: 'users/two_factor_authentications' + resource :role, only: [:show, :update], controller: 'users/roles' end resources :custom_emojis, only: [:index, :new, :create] do @@ -320,6 +314,7 @@ Rails.application.routes.draw do end end + resources :roles, except: [:show] resources :account_moderation_notes, only: [:create, :destroy] resource :follow_recommendations, only: [:show, :update] resources :tags, only: [:show, :update] -- cgit