recordAuthorize is the internal method that records the Authorize() call.
(subject rbac.Subject, action policy.Action, object rbac.Object, authzErr error)
| 260 | |
| 261 | // recordAuthorize is the internal method that records the Authorize() call. |
| 262 | func (r *RecordingAuthorizer) recordAuthorize(subject rbac.Subject, action policy.Action, object rbac.Object, authzErr error) { |
| 263 | r.Lock() |
| 264 | defer r.Unlock() |
| 265 | |
| 266 | r.Called = append(r.Called, AuthCall{ |
| 267 | AuthCall: rbac.AuthCall{ |
| 268 | Actor: subject, |
| 269 | Action: action, |
| 270 | Object: object, |
| 271 | }, |
| 272 | Err: authzErr, |
| 273 | callers: []string{ |
| 274 | // This is a decent stack trace for debugging. |
| 275 | // Some dbauthz calls are a bit nested, so we skip a few. |
| 276 | caller(2), |
| 277 | caller(3), |
| 278 | caller(4), |
| 279 | caller(5), |
| 280 | }, |
| 281 | }) |
| 282 | } |
| 283 | |
| 284 | func caller(skip int) string { |
| 285 | pc, file, line, ok := runtime.Caller(skip + 1) |