ぼざクリタグ広場 https://hub.nizika.monster
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
562 B

  1. class ApplicationController < ActionController::API
  2. before_action :authenticate_user
  3. def current_user
  4. @current_user
  5. end
  6. private
  7. def authenticate_user
  8. code = request.headers['X-Transfer-Code'] || request.headers['HTTP_X_TRANSFER_CODE']
  9. @current_user = User.find_by(inheritance_code: code)
  10. end
  11. def bool? key, default: false
  12. return default if params[key].nil?
  13. s = params[key].to_s.strip.downcase
  14. if default
  15. !(s.in?(['0', 'false', 'off', 'no']))
  16. else
  17. s.in?(['', '1', 'true', 'on', 'yes'])
  18. end
  19. end
  20. end