Class: PactBroker::Api::Authorization::ResourceAccessRules
- Inherits:
-
Object
- Object
- PactBroker::Api::Authorization::ResourceAccessRules
- Defined in:
- lib/pact_broker/api/authorization/resource_access_rules.rb
Constant Summary collapse
Instance Method Summary collapse
- #access_allowed?(env, level) ⇒ Boolean
-
#initialize(rules) ⇒ ResourceAccessRules
constructor
A new instance of ResourceAccessRules.
Constructor Details
#initialize(rules) ⇒ ResourceAccessRules
Returns a new instance of ResourceAccessRules.
10 11 12 |
# File 'lib/pact_broker/api/authorization/resource_access_rules.rb', line 10 def initialize(rules) @rules = rules end |
Instance Method Details
#access_allowed?(env, level) ⇒ Boolean
14 15 16 17 18 19 20 |
# File 'lib/pact_broker/api/authorization/resource_access_rules.rb', line 14 def access_allowed?(env, level) !!rules.find do | rule_level, allowed_methods, path_pattern | level_allowed?(level, rule_level) && method_allowed?(env, allowed_methods) && path_allowed?(env, path_pattern) end end |