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

Function PopulateContext

auth/context.go:216–224  ·  view source on GitHub ↗

PopulateContext sets the appropriate fields in the context, based on the user object

(ctx context.Context, user params.User, authExpires *time.Time)

Source from the content-addressed store, hash-verified

214// PopulateContext sets the appropriate fields in the context, based on
215// the user object
216func PopulateContext(ctx context.Context, user params.User, authExpires *time.Time) context.Context {
217 ctx = SetUserID(ctx, user.ID)
218 ctx = SetAdmin(ctx, user.IsAdmin)
219 ctx = SetIsEnabled(ctx, user.Enabled)
220 ctx = SetFullName(ctx, user.FullName)
221 ctx = SetExpires(ctx, authExpires)
222 ctx = SetPasswordGeneration(ctx, user.Generation)
223 return ctx
224}
225
226func SetExpires(ctx context.Context, expires *time.Time) context.Context {
227 if expires == nil {

Calls 6

SetUserIDFunction · 0.85
SetAdminFunction · 0.85
SetIsEnabledFunction · 0.85
SetFullNameFunction · 0.85
SetExpiresFunction · 0.85
SetPasswordGenerationFunction · 0.85