lib/declarative_authorization/in_controller.rb
# If the current user meets the given privilege, permitted_to? returns true
# and yields to the optional block.  The attribute checks that are defined
# in the authorization rules are only evaluated if an object is given
# for context.
# 
# See examples for Authorization::AuthorizationHelper #permitted_to?
#
If the current user meets the given privilege, permitted_to. returns true
and yields to the optional block.  The attribute checks that are defined
in the authorization rules are only evaluated if an object is given
for context.


If the current user meets the given privilege permitted_to . returns true and yields to the optional block . The attribute checks that are defined in the authorization rules are only evaluated if an object is given for context .
def permitted_to? (privilege, object_or_sym = nil, &block)
      context = object = nil
      if object_or_sym.is_a?(Symbol)
        context = object_or_sym
      else
        object = object_or_sym
      end
      authorization_engine.permit?(privilege, 
          {:user => current_user, 
           :object => object,
           :context => context,
           :skip_attribute_test => object.nil?}, 
          &block)
    end
def permitted_to? ( privilege , object_or_sym = nil , & block ) context = object = nil if object_or_sym . is_a? ( Symbol ) context = object_or_sym else object = object_or_sym end authorization_engine . permit? ( privilege , { :user => current_user , :object => object , :context => context , :skip_attribute_test => object . nil? } , & block ) end
If the current user meets the given privilege, permitted_to?
If the current user meets the given privilege permitted_to?
# TODO infer context also from self.class.name
privilege
<not_specific>
object_or_sym
<not_specific>
block
<not_specific>