package auth import ( "context" "gitserver.in/patialtech/rano/config" ) type SessionUser struct { ID int64 Email string DisplayName string RoleID int } func CtxWithUser(ctx context.Context, u *AuthUser) context.Context { return context.WithValue(ctx, config.AuthUserCtxKey, &SessionUser{ ID: u.ID, Email: u.Email, DisplayName: u.DisplayName, RoleID: u.RoleID, }) } func CtxUser(ctx context.Context) *SessionUser { u, _ := ctx.Value(config.AuthUserCtxKey).(*SessionUser) return u }