(action schema.Action, policies []*schema.Policy, url string)
| 351 | } |
| 352 | |
| 353 | func canUseAction(action schema.Action, policies []*schema.Policy, url string) bool { |
| 354 | for _, policy := range policies { |
| 355 | if policy.GetResourcePathRegexp().MatchString(url) && isMatchingPolicy(action, policy) { |
| 356 | return true |
| 357 | } |
| 358 | } |
| 359 | return false |
| 360 | } |
| 361 | |
| 362 | func isMatchingPolicy(action schema.Action, policy *schema.Policy) bool { |
| 363 | return action.ID == policy.Action || policy.Action == "*" || (policy.Action == "read" && action.Method == "GET") || (policy.Action == "update" && action.Method == "POST") |
no test coverage detected