IsAdmin returns a boolean indicating whether or not the context belongs to a logged in user and if that context has the admin flag set
(ctx context.Context)
| 288 | // or not the context belongs to a logged in user |
| 289 | // and if that context has the admin flag set |
| 290 | func IsAdmin(ctx context.Context) bool { |
| 291 | elem := ctx.Value(isAdminKey) |
| 292 | if elem == nil { |
| 293 | return false |
| 294 | } |
| 295 | return elem.(bool) |
| 296 | } |
| 297 | |
| 298 | // SetUserID sets the userID in the context |
| 299 | func SetUserID(ctx context.Context, userID string) context.Context { |
no outgoing calls
no test coverage detected