Module: Rolypoly::ControllerRoleDSL::InstanceMethods

Defined in:
lib/rolypoly/controller_role_dsl.rb

Instance Method Summary collapse

Instance Method Details

#allow?(options = {}) ⇒ Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/rolypoly/controller_role_dsl.rb', line 47

def allow?(options = {})
  rolypoly_gatekeepers.allow?(current_roles, action_name, rolypoly_resource_map.merge(options))
end

#current_gatekeepersObject



41
42
43
44
45
# File 'lib/rolypoly/controller_role_dsl.rb', line 41

def current_gatekeepers
  rolypoly_gatekeepers.select { |gatekeeper|
    gatekeeper.action? action_name
  }
end

#current_rolesObject



33
34
35
# File 'lib/rolypoly/controller_role_dsl.rb', line 33

def current_roles
  allowed_roles(action_name)
end

#failed_role_check!Object



29
30
31
# File 'lib/rolypoly/controller_role_dsl.rb', line 29

def failed_role_check!
  raise Rolypoly::FailedRoleCheckError
end

#public?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/rolypoly/controller_role_dsl.rb', line 37

def public?
  super(action_name)
end

#rolypoly_check_role_access!Object



25
26
27
# File 'lib/rolypoly/controller_role_dsl.rb', line 25

def rolypoly_check_role_access!
  failed_role_check! unless rolypoly_role_access?
end