Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gate ¶
type Gate interface { // WithContext returns a new Gate instance with the given context. WithContext(ctx context.Context) Gate // Allows determines if the given ability should be granted for the current user. Allows(ability string, arguments map[string]any) bool // Denies determines if the given ability should be denied for the current user. Denies(ability string, arguments map[string]any) bool // Inspect the given ability against the current user. Inspect(ability string, arguments map[string]any) Response // Define a new ability. Define(ability string, callback func(ctx context.Context, arguments map[string]any) Response) // Any one of the given abilities should be granted for the current user. Any(abilities []string, arguments map[string]any) bool // None of the given abilities should be granted for the current user. None(abilities []string, arguments map[string]any) bool // Before register a callback to run before all Gate checks. Before(callback func(ctx context.Context, ability string, arguments map[string]any) Response) // After register a callback to run after all Gate checks. After(callback func(ctx context.Context, ability string, arguments map[string]any, result Response) Response) }
Click to show internal directories.
Click to hide internal directories.