@@ -0,0 +1,19 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gardomatic.kleiax.de/lib/client"
|
||||
)
|
||||
|
||||
type contextKey string
|
||||
|
||||
const (
|
||||
isAuthenticatedContextKey = contextKey("isAuthenticated")
|
||||
userContextKey = contextKey("user")
|
||||
)
|
||||
|
||||
func userFromContext(ctx context.Context) (client.User, bool) {
|
||||
user, ok := ctx.Value(userContextKey).(client.User)
|
||||
return user, ok
|
||||
}
|
||||
Reference in New Issue
Block a user