module Rolypoly::ControllerRoleDSL::InstanceMethods

Public Instance Methods

allow?(options = {}) click to toggle source
# File lib/rolypoly/controller_role_dsl.rb, line 53
def allow?(options = {})
  rolypoly_gatekeepers.allow?(current_roles, action_name, rolypoly_resource_map.merge(options))
end
current_gatekeepers() click to toggle source
# File lib/rolypoly/controller_role_dsl.rb, line 47
def current_gatekeepers
  rolypoly_gatekeepers.select { |gatekeeper|
    gatekeeper.action? action_name
  }
end
current_roles() click to toggle source
# File lib/rolypoly/controller_role_dsl.rb, line 37
def current_roles
  return [] if rolypoly_gatekeepers.empty?

  allowed_roles(action_name)
end
failed_role_check!() click to toggle source
# File lib/rolypoly/controller_role_dsl.rb, line 33
def failed_role_check!
  raise Rolypoly::FailedRoleCheckError
end
public?() click to toggle source
Calls superclass method
# File lib/rolypoly/controller_role_dsl.rb, line 43
def public?
  super(action_name)
end
rolypoly_check_role_access!() click to toggle source
# File lib/rolypoly/controller_role_dsl.rb, line 29
def rolypoly_check_role_access!
  failed_role_check! unless rolypoly_role_access?
end

Private Instance Methods

rolypoly_role_access?() click to toggle source
# File lib/rolypoly/controller_role_dsl.rb, line 57
        def rolypoly_role_access?
  allow?
end