Module: Fib::Additions::RailsControllerAddition

Extended by:
ActiveSupport::Concern
Includes:
ContainerAddition
Defined in:
lib/fib/additions/rails_controller_addition.rb

Instance Method Summary collapse

Methods included from ContainerAddition

#fib_container, #fib_inherit

Instance Method Details

#can?(key, obj = nil) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/fib/additions/rails_controller_addition.rb', line 16

def can? key, obj=nil
  key_element = permissions.find_key(key)
  key_element.present? && key_element.pass_condition?(current_user, obj)
end

#cannot?(key, obj = nil) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/fib/additions/rails_controller_addition.rb', line 21

def cannot? key, obj=nil
  !can?(key, obj)
end