| 1234567891011121314151617181920212223242526272829303132 |
- using InvercargillSqlInversion;
- using Inversion;
- namespace Spry {
- /**
- * Inversion module that registers Spry's user store: the `spry_users` and
- * `spry_user_permissions` schema (M0001 migration), the entity/projection
- * mappings, and the scoped {@link Spry.Authentication.UserService}.
- *
- * Register this module with the application container alongside
- * `StatumModule`; it registers no endpoints. Ready-made actions are bound
- * separately via {@link SpryAuth.register_actions} or
- * `StatumConfigurator.action`.
- */
- public class SpryModule : Object, Module {
- public void register_components(Container container) throws Error {
- // Sql table setup
- var sql = container.configure_with<DatabaseConfigurator>();
- sql.add_migration<Authentication.Migrations.M0001_Initial>();
- sql.add_entity<Authentication.UserEntity>(Authentication.UserEntity.entity_mapping);
- sql.add_entity<Authentication.UserPermissionEntity>(Authentication.UserPermissionEntity.entity_mapping);
- sql.add_projection<Authentication.UserProjection>(Authentication.UserProjection.projection_mapping);
- // Service setup
- container.register_scoped<Authentication.UserService>();
- }
- }
- }
|