Module: SqAuth::SqAuthHelpers::ActionController::ClassMethods
Instance Method Summary collapse
Methods included from RailsDSL
#access_action_except, #access_actions_except, #method_missing
Methods included from DSL
#access_action, #access_actions, #draw_for, #sq_auth_access
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class SqAuth::SqAuthHelpers::RailsDSL
Instance Method Details
#create_filter(roles, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/sq_auth/sq_auth_helpers/sq_auth_helpers_rails.rb', line 11 def create_filter roles, = {} = {} [:only] = @sq_auth_actions_only [:except] = @sq_auth_actions_except before_filter() do |controller| format_type = [:format_type] format_condition = (format_type == "all") || (format_type.nil?) || (controller.request.format.send("#{format_type}?".to_sym)) if format_condition error_proc = nil = {} if format_type == "json" error_proc = Proc.new do || render json: end [:draw] = false else error_proc = Proc.new do || render text: end [:draw] = true end SqAuth.api_filter(roles, Proc.new {}, error_proc, ) end end end |