Files
astuto/app/helpers/application_helper.rb

16 lines
376 B
Ruby
Raw Normal View History

2019-08-18 14:51:37 +02:00
module ApplicationHelper
2022-05-01 18:00:38 +02:00
def authenticate_admin
unless user_signed_in?
flash[:alert] = t('backend.errors.not_logged_in')
2022-05-01 18:00:38 +02:00
redirect_to new_user_session_path
return
end
unless current_user.moderator? || current_user.admin?
flash[:alert] = t('backend.errors.not_enough_privileges')
2022-05-01 18:00:38 +02:00
redirect_to root_path
return
end
end
2019-08-18 14:51:37 +02:00
end