(w http.ResponseWriter, r *http.Request, action, path string, s *schema.Schema, auth schema.Authorization)
| 40 | ) |
| 41 | |
| 42 | func authorization(w http.ResponseWriter, r *http.Request, action, path string, s *schema.Schema, auth schema.Authorization) (*schema.Policy, *schema.Role) { |
| 43 | manager := schema.GetManager() |
| 44 | log.Debug("[authorization*] %s %v", action, auth) |
| 45 | if auth == nil { |
| 46 | return schema.NewEmptyPolicy(), nil |
| 47 | } |
| 48 | policy, role := manager.PolicyValidate(action, path, auth) |
| 49 | if policy == nil { |
| 50 | log.Debug("No policy match: %s %s", action, path) |
| 51 | return nil, nil |
| 52 | } |
| 53 | return policy, role |
| 54 | } |
| 55 | |
| 56 | func addParamToQuery(r *http.Request, key, value string) { |
| 57 | r.URL.RawQuery += "&" + key + "=" + value |
no test coverage detected