PopulateContext sets the appropriate fields in the context, based on the user object
(ctx context.Context, user params.User, authExpires *time.Time)
| 214 | // PopulateContext sets the appropriate fields in the context, based on |
| 215 | // the user object |
| 216 | func 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 | |
| 226 | func SetExpires(ctx context.Context, expires *time.Time) context.Context { |
| 227 | if expires == nil { |