MCPcopy Create free account
hub / github.com/cloudbase/garm / GetAdminContext

Function GetAdminContext

auth/context.go:314–322  ·  view source on GitHub ↗

GetAdminContext will return an admin context. This can be used internally when fetching users.

(ctx context.Context)

Source from the content-addressed store, hash-verified

312// GetAdminContext will return an admin context. This can be used internally
313// when fetching users.
314func GetAdminContext(ctx context.Context) context.Context {
315 if ctx == nil {
316 ctx = context.Background()
317 }
318 ctx = SetUserID(ctx, "")
319 ctx = SetAdmin(ctx, true)
320 ctx = SetIsEnabled(ctx, true)
321 return ctx
322}

Callers 6

SetupTestMethod · 0.92
CollectObjectMetricFunction · 0.92
ensureTemplatesMethod · 0.92
mainFunction · 0.92
NewControllerFunction · 0.92
NewAPIControllerFunction · 0.92

Calls 3

SetUserIDFunction · 0.85
SetAdminFunction · 0.85
SetIsEnabledFunction · 0.85

Tested by 1

SetupTestMethod · 0.74