Documentation ¶
Index ¶
- func CheckContext(ctx context.Context, id sdktypes.ID, action string, opts ...func(*checkCfg)) error
- func ContextWithCheckFunc(ctx context.Context, check CheckFunc) context.Context
- func DisableCheckForTesting()
- func HTTPInterceptor(checkFunc CheckFunc, h http.Handler) http.Handler
- func WithConvertForbiddenToNotFound(cfg *checkCfg)
- func WithNop(*checkCfg)
- type CheckFunc
- type CheckOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckContext ¶
func ContextWithCheckFunc ¶
func DisableCheckForTesting ¶
func DisableCheckForTesting()
func HTTPInterceptor ¶
Enrich the request context with the check function.
func WithConvertForbiddenToNotFound ¶
func WithConvertForbiddenToNotFound(cfg *checkCfg)
Types ¶
type CheckFunc ¶
type CheckFunc = func(ctx context.Context, id sdktypes.ID, action string, opts ...func(*checkCfg)) error
id: resource id to check access to. action: action to check access for. data: optional data to check access with (such as list filter).
func NewPolicyCheckFunc ¶
PolicyCheckFunc is a function that checks access to a resource using a policy. Actions can be either of:
- "some_action_name" -> {"action": "some_action_name", "action_type": ""}
- "action_type:some_action_name" -> {"action": "some_action_name", "action_type": "action_type"}
type CheckOpt ¶
type CheckOpt func(*checkCfg)
func WithAssociationWithID ¶
Set `data.associated_<name>_org_id` in the check context. This will cause the checker to automatically deduce what org it belongs to based on the ID.
Click to show internal directories.
Click to hide internal directories.