def lets?(clearance_level, action, resource, options = {})
      clearance_level = clearance_level.to_s.singularize.to_sym
      action = action.to_sym
      controller = get_controller_name(resource, options)

      # Load the controller to ensure its rules are loaded (lazy loading rules).
      controller.constantize.new
      rules = @rules[controller]
      return false unless rules

      # Check rules
      Array(rules[:all]).include?(:all)               ||
      Array(rules[:all]).include?(action)             ||
      Array(rules[clearance_level]).include?(:all)    ||
      Array(rules[clearance_level]).include?(action)
    end
def lets?(clearance_level, action, resource, options = {})
      clearance_level = clearance_level.to_s.singularize.to_sym
      action = action.to_sym
      controller = get_controller_name(resource, options)

      # Load the controller to ensure its rules are loaded (lazy loading rules).
      controller.constantize.new
      rules = @rules[controller]
      return false unless rules

      # Check rules
      Array(rules[:all]).include?(:all)               ||
      Array(rules[:all]).include?(action)             ||
      Array(rules[clearance_level]).include?(:all)    ||
      Array(rules[clearance_level]).include?(action)
    end
Check if a given clearance level allows to perform an action on a resource.
 Clearance level and resource can be either plural or singular.

 == Examples:

   lets? :users, :create, :profiles
   lets? :users, :create, @profile
   lets? :users, :create, ProfilesController
   # True if users are allowed to access 'profiles#create'.

   lets? :admin, :edit, :article, namespace: :admin
   lets? :admin, :edit, @admin_article
   lets? :admin, :edit, Admin::ArticlesController
   # True if any admin is allowed to access 'admin/articles#edit'.