jeudi 22 novembre 2018

before_filter running out of order

We have following filters in controller:

  before_action :authenticate_api_request!, except: [:reply_messages]
  before_action :community_uuid
  before_action :is_user_blocked?, only: [:create, :like, :dislike, :flag, :reply_message]
  before_action :user_confirmed_email?, only: [:create]
  before_action :get_message, only: [:like, :dislike, :flag, :remove, :get_message_json, :reply_message, :reply_messages]
  before_action :get_reply_message, only: [:reply_message]
  before_action :get_group, only: [:create]
  before_action :is_blocked_from_group?, only: [:create, :like, :dislike, :reply_message]

and order in which they are executed is:

user_confirmed_email?
get_message
get_reply_message
authenticate_api_request!
community_uuid
is_user_blocked?
get_group
is_blocked_from_group?

The problem here is authenticate_api_request!, community_uuid and is_user_blocked? is called after user_confirmed_email?.

Aucun commentaire:

Enregistrer un commentaire