| 305 | } |
| 306 | |
| 307 | func (r *RecordingAuthorizer) Prepare(ctx context.Context, subject rbac.Subject, action policy.Action, objectType string) (rbac.PreparedAuthorized, error) { |
| 308 | r.RLock() |
| 309 | defer r.RUnlock() |
| 310 | if r.Wrapped == nil { |
| 311 | panic("Developer error: RecordingAuthorizer.Wrapped is nil") |
| 312 | } |
| 313 | |
| 314 | prep, err := r.Wrapped.Prepare(ctx, subject, action, objectType) |
| 315 | if err != nil { |
| 316 | return nil, err |
| 317 | } |
| 318 | return &PreparedRecorder{ |
| 319 | rec: r, |
| 320 | prepped: prep, |
| 321 | subject: subject, |
| 322 | action: action, |
| 323 | }, nil |
| 324 | } |
| 325 | |
| 326 | // Reset clears the recorded Authorize() calls. |
| 327 | func (r *RecordingAuthorizer) Reset() { |