mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
change masquerade permissions
This commit is contained in:
parent
f0b6619e1b
commit
f6c1b7817f
@ -2,7 +2,7 @@ class AdminController < ApplicationController
|
||||
layout 'admin'
|
||||
|
||||
before_action :authenticate_user!
|
||||
before_action :require_admin_access, except: [:masquerade]
|
||||
before_action :require_admin_access
|
||||
|
||||
def dashboard
|
||||
end
|
||||
@ -32,14 +32,15 @@ class AdminController < ApplicationController
|
||||
end
|
||||
|
||||
def masquerade
|
||||
# Do not allow masquerading in production, even for admins.
|
||||
return unless Rails.env.development?
|
||||
|
||||
masqueree = User.find_by(id: params[:user_id])
|
||||
sign_in masqueree
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
def unsubscribe
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def require_admin_access
|
||||
|
||||
@ -166,11 +166,11 @@ Rails.application.routes.draw do
|
||||
scope 'admin_stats' do
|
||||
get '/', to: 'admin#dashboard', as: :admin_dashboard
|
||||
get '/content_type/:type', to: 'admin#content_type', as: :admin_content_type
|
||||
|
||||
get '/attributes', to: 'admin#attributes', as: :admin_attributes
|
||||
get '/masquerade/:user_id', to: 'admin#masquerade', as: :masquerade
|
||||
end
|
||||
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
|
||||
get '/admin/unsubscribe', to: 'admin#unsubscribe'
|
||||
|
||||
scope 'export' do
|
||||
get '/', to: 'export#index', as: :notebook_export
|
||||
|
||||
Loading…
Reference in New Issue
Block a user