def is_authorized_for_action_with_config?(action, config)
      request_may_proceed = false
      return true unless config.present?

      defaults = {
        user: current_user,
        permission: action.to_s,
        message: I18n.t('authorizable.not_authorized'),
        flash_type: Authorizable.configuration.flash_error
      }

      options = defaults.merge(config)

      # run permission
      request_may_proceed = evaluate_action_permission(options)

      # redirect
      unless request_may_proceed and request.format == :html
        authorizable_respond_with(
          options[:flash_type],
          options[:message],
          options[:redirect_path]
        )

        # halt
        return false
      end

      # proceed with request execution
      true
    end
def is_authorized_for_action_with_config?(action, config)
      request_may_proceed = false
      return true unless config.present?

      defaults = {
        user: current_user,
        permission: action.to_s,
        message: I18n.t('authorizable.not_authorized'),
        flash_type: Authorizable.configuration.flash_error
      }

      options = defaults.merge(config)

      # run permission
      request_may_proceed = evaluate_action_permission(options)

      # redirect
      unless request_may_proceed and request.format == :html
        authorizable_respond_with(
          options[:flash_type],
          options[:message],
          options[:redirect_path]
        )

        # halt
        return false
      end

      # proceed with request execution
      true
    end
check if the resource can perform the action and respond
 according to the specefied config

 @param [Symbol] action the current controller action
 @param [Hash] config the configuration for what to do with the given action
 @return [Boolean] the result of the permission evaluation