MCPcopy Index your code
hub / github.com/coder/coder / recordAuthorize

Method recordAuthorize

coderd/coderdtest/authorize.go:262–282  ·  view source on GitHub ↗

recordAuthorize is the internal method that records the Authorize() call.

(subject rbac.Subject, action policy.Action, object rbac.Object, authzErr error)

Source from the content-addressed store, hash-verified

260
261// recordAuthorize is the internal method that records the Authorize() call.
262func (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
284func caller(skip int) string {
285 pc, file, line, ok := runtime.Caller(skip + 1)

Callers 2

AuthorizeMethod · 0.95
AuthorizeMethod · 0.80

Calls 3

callerFunction · 0.85
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected