mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-21 19:25:57 +00:00
18 lines
549 B
Go
18 lines
549 B
Go
package chat
|
|
|
|
import "context"
|
|
|
|
type executeAuthorityContextKey struct{}
|
|
|
|
// WithExecuteAuthority carries trusted transport authority into read-only
|
|
// projection endpoints. The value is server-authored and cannot originate in
|
|
// a model/provider payload.
|
|
func WithExecuteAuthority(ctx context.Context, allowed bool) context.Context {
|
|
return context.WithValue(ctx, executeAuthorityContextKey{}, allowed)
|
|
}
|
|
|
|
func executeAuthorityFromContext(ctx context.Context) bool {
|
|
allowed, _ := ctx.Value(executeAuthorityContextKey{}).(bool)
|
|
return allowed
|
|
}
|