Move support_staff?
method into ApplicationController
I want to use it in a controller in our next change!
This commit is contained in:
parent
d9bf4f745b
commit
0d2648d030
2 changed files with 6 additions and 8 deletions
|
@ -4,7 +4,7 @@ require 'async/container'
|
|||
class ApplicationController < ActionController::Base
|
||||
protect_from_forgery
|
||||
|
||||
helper_method :current_user, :user_signed_in?
|
||||
helper_method :current_user, :support_staff?, :user_signed_in?
|
||||
|
||||
before_action :set_locale
|
||||
|
||||
|
@ -111,10 +111,12 @@ class ApplicationController < ActionController::Base
|
|||
return_to || root_path
|
||||
end
|
||||
|
||||
def support_staff?
|
||||
current_user&.support_staff?
|
||||
end
|
||||
|
||||
def support_staff_only
|
||||
unless current_user&.support_staff?
|
||||
raise AccessDenied, "Support staff only"
|
||||
end
|
||||
raise AccessDenied, "Support staff only" unless support_staff?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -127,10 +127,6 @@ module ApplicationHelper
|
|||
!@hide_home_link
|
||||
end
|
||||
|
||||
def support_staff?
|
||||
user_signed_in? && current_user.support_staff?
|
||||
end
|
||||
|
||||
def impress_2020_meta_tags
|
||||
origin = Rails.configuration.impress_2020_origin
|
||||
support_secret = Rails.application.credentials.dig(
|
||||
|
|
Loading…
Reference in a new issue