MCPcopy Index your code
hub / github.com/git-bug/git-bug / CtxWithUser

Function CtxWithUser

api/auth/context.go:15–17  ·  view source on GitHub ↗

CtxWithUser attaches an Identity to a context.

(ctx context.Context, userId entity.Id)

Source from the content-addressed store, hash-verified

13
14// CtxWithUser attaches an Identity to a context.
15func CtxWithUser(ctx context.Context, userId entity.Id) context.Context {
16 return context.WithValue(ctx, identityCtxKey, userId)
17}
18
19// UserFromCtx retrieves an IdentityCache from the context.
20// If there is no identity in the context, ErrNotAuthenticated is returned.

Callers 2

TestGitFileHandlersFunction · 0.92
MiddlewareFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestGitFileHandlersFunction · 0.74