module Mongoid::Criteria::Permission

def should_permit?(criteria)

Returns:
  • (true | false) - if should permit

Parameters:
  • criteria (Object) --

Other tags:
    Api: - private

Other tags:
    Example: Ignoring ActionController::Parameters -
def should_permit?(criteria)
  if criteria.respond_to?(:permitted?)
    return criteria.permitted?
  elsif criteria.respond_to?(:each)
    criteria.each do |criterion|
      return false unless should_permit?(criterion)
    end
  end
  true
end