template-monorepo/internal/logic/permission/actor.go

23 lines
634 B
Go

package permission
import (
"context"
"gateway/internal/library/actor"
)
// Actor aliases library/actor.Actor so existing permission logic keeps
// referring to `permission.Actor` without an import change.
type Actor = actor.Actor
// WithActor stores tenant/uid on the context for permission logic
// handlers. Delegates to library/actor.
func WithActor(ctx context.Context, tenantID, uid string) context.Context {
return actor.WithActor(ctx, tenantID, uid)
}
// ActorFromContext reads the actor injected by AuthJWT middleware.
func ActorFromContext(ctx context.Context) (Actor, error) {
return actor.ActorFromContext(ctx)
}