feat: initial commit
This commit is contained in:
@ -3,14 +3,14 @@ package context
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/markbates/goth"
|
||||
"forge.cadoles.com/wpetit/clearcase/internal/core/model"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const keyUser = "user"
|
||||
|
||||
func User(ctx context.Context) *goth.User {
|
||||
user, ok := ctx.Value(keyUser).(*goth.User)
|
||||
func User(ctx context.Context) *model.User {
|
||||
user, ok := ctx.Value(keyUser).(*model.User)
|
||||
if !ok {
|
||||
panic(errors.New("no user in context"))
|
||||
}
|
||||
@ -18,6 +18,6 @@ func User(ctx context.Context) *goth.User {
|
||||
return user
|
||||
}
|
||||
|
||||
func SetUser(ctx context.Context, user *goth.User) context.Context {
|
||||
func SetUser(ctx context.Context, user *model.User) context.Context {
|
||||
return context.WithValue(ctx, keyUser, user)
|
||||
}
|
||||
|
Reference in New Issue
Block a user