Documentation
¶
Overview ¶
Package infrastructure provides cross-cutting bootstrap wiring for the API server: the Casbin RBAC enforcer and the startup hooks that seed the default namespace, the built-in default role, and the RBAC policy sync. The HTTP/DB/messaging adapters live under module/adapter.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidPermissionName = errors.New("invalid permission name (want resource:action)")
ErrInvalidPermissionName is returned when a role references a permission name that is not in the expected "resource:action" form.
Functions ¶
func Identity ¶
func Identity[T any](a T) T
Identity is a generic function that returns the input value. It is a helper function to generate a function that returns the input value. It is used to provide a function as a interface.
func New ¶
func New(databaseType config.DatabaseType) fx.Option
New creates the infrastructure bootstrap module: the Casbin RBAC enforcer and the startup hooks that seed the default namespace, default role, and RBAC policies.
The database type selects how the Casbin enforcer stores its policies: the explicit "mongodb" persists them in a "casbin_rules" collection, while any other value (including the default/empty, i.e. standalone) keeps them in process memory and does not depend on a *mongo.Client.
Types ¶
This section is empty.