2025-04-02 16:53:06 +02:00
|
|
|
package execution
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
"github.com/zitadel/zitadel/internal/api/authz"
|
|
|
|
|
"github.com/zitadel/zitadel/internal/eventstore"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const ExecutionUserID = "EXECUTION"
|
|
|
|
|
|
2025-07-29 10:58:42 +02:00
|
|
|
func HandlerContext(parent context.Context, event *eventstore.Aggregate) context.Context {
|
|
|
|
|
ctx := authz.WithInstanceID(parent, event.InstanceID)
|
2025-04-02 16:53:06 +02:00
|
|
|
return authz.SetCtxData(ctx, authz.CtxData{UserID: ExecutionUserID, OrgID: event.ResourceOwner})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ContextWithExecuter(ctx context.Context, aggregate *eventstore.Aggregate) context.Context {
|
|
|
|
|
return authz.SetCtxData(ctx, authz.CtxData{UserID: ExecutionUserID, OrgID: aggregate.ResourceOwner})
|
|
|
|
|
}
|