Module: AccessAllow::ControllerAccessDsl

Extended by:
ActiveSupport::Concern
Defined in:
lib/access_allow/controller_access_dsl.rb

Overview

Setup rules and configuration to specify access for a controller. Either specific actions or all actions.

Instance Method Summary collapse

Instance Method Details

#access_allowed?(*check_rules) ⇒ Boolean

‘access_allowed?` is exposed as a view helper to execute checks or allow rules and return if they passed or not. Useful for doing conditional work in the view or a controller action

Returns:

  • (Boolean)


62
63
64
65
66
67
68
# File 'lib/access_allow/controller_access_dsl.rb', line 62

def access_allowed?(*check_rules)
  self.class.access_manager.allow?(
    check_rules,
    send(AccessAllow.configuration.current_user_method),
    self
  )
end