Files
upstream-traggo/test/fake/user.go
upstream-mirror cda7c1a474
Some checks failed
build / build (push) Failing after 3s
snapshot of https://github.com/traggo/server.git (master, 2026-09-16; blobs > 131072B omitted)
2026-09-16 05:24:45 +05:00

23 lines
434 B
Go

package fake
import (
"context"
"github.com/traggo/server/auth"
"github.com/traggo/server/model"
)
// User create a context with a fake user.
func User(id int) context.Context {
return UserWithPerm(id, true)
}
// UserWithPerm create a context with a fake user.
func UserWithPerm(id int, admin bool) context.Context {
return auth.WithUser(context.Background(), &model.User{
ID: id,
Name: "fake",
Admin: admin,
})
}