From: Raphaƫl Gertz Date: Thu, 31 Oct 2024 06:45:04 +0000 (+0100) Subject: Add rapsys user configuration X-Git-Tag: 0.0.5~6 X-Git-Url: https://git.rapsys.eu/treebundle/commitdiff_plain/48ae76ae40baf431a9df500a07877e962f45be7c?ds=inline Add rapsys user configuration Add doctrine configuration Add security password hasher definition Add bundle fixture Add bundle repository factory --- diff --git a/config/packages/rapsystree.yaml b/config/packages/rapsystree.yaml new file mode 100644 index 0000000..3d19c54 --- /dev/null +++ b/config/packages/rapsystree.yaml @@ -0,0 +1,189 @@ +# Parameters configuration +parameters: + +# RapsysTree configuration +rapsystree: + contact: + address: 'veranda@rapsys.eu' + name: 'Rapsys Photo' + languages: + en_gb: 'English' + fr_fr: 'French' + locale: 'fr_fr' + locales: [ 'fr_fr', 'en_gb' ] + logo: + alt: 'Rapsys photo''s logo' + title: 'Rapsys Photo' + roots: + Dcim: '/var/www/dcim' + Doc: '/var/www/doc' + Photo: '/var/www/photo' + Tango: '/var/www/tango' + Video: '/var/www/video' + +# RapsysUser configuration +rapsysuser: + # Class replacement + class: + group: 'Rapsys\TreeBundle\Entity\Group' + civility: 'Rapsys\TreeBundle\Entity\Civility' + user: 'Rapsys\TreeBundle\Entity\User' + # Default replacement + default: + admin: 'ROLE_ADMIN' + civility: 'Mister' + group: [ 'User' ] + languages: '%rapsystree.languages%' + # Default context + context: + site: '%rapsystree.title%' + # Route replacement + route: + home: + name: 'rapsystree' + context: [] + +# Doctrine configuration +doctrine: + # Dbal configuration + dbal: + charset: 'utf8mb4' + default_table_options: + charset: 'utf8mb4' + collate: 'utf8mb4_unicode_ci' + # Orm configuration + orm: + # Replace repository factory + repository_factory: 'Rapsys\TreeBundle\Factory' + + #Resolve UserBundle entities with TreeBundle one + #XXX: without these lines, relations are lookup in parent namespace ignoring TreeBundle extension + resolve_target_entities: + Rapsys\UserBundle\Entity\Group: 'Rapsys\TreeBundle\Entity\Group' + Rapsys\UserBundle\Entity\Civility: 'Rapsys\TreeBundle\Entity\Civility' + Rapsys\UserBundle\Entity\User: 'Rapsys\TreeBundle\Entity\User' + +# Security configuration +security: + # Set firewall + firewalls: + # Disables authentication for assets and the profiler, adapt it according to your needs + dev: + pattern: '^/(_(profiler|wdt)|css|images|js)/' + security: false + + # Mail firewall + main: + # Allow anonymous access + #anonymous: ~ + #lazy: true + + # Activate database provider + #XXX: comment this key in config/security.yaml to prevent users_in_memory induced failures + provider: 'database' + + # Activate user checker + user_checker: 'security.user_checker' + + #XXX: https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate + #http_basic: ~ + + # Set form login + #XXX: https://symfony.com/doc/current/security/form_login_setup.html + #TODO: https://symfony.com/doc/current/security/guard_authentication.html + form_login: + # Redirect to referer if different from login route + use_referer: true + # Login path + login_path: 'rapsysuser_login' + # Check path + check_path: 'rapsysuser_login' + # Username parameter + username_parameter: 'login[mail]' + # Password parameter + password_parameter: 'login[password]' + # Enable login csrf protection + enable_csrf: false + # Csrf parameter + csrf_parameter: 'login[_token]' + # Csrf id + csrf_token_id: 'login' + + # Set logout route + logout: + # Logout route + path: 'rapsysuser_logout' + # Logout default target + target: 'rapsystree' + + # Set custom access denied handler + #access_denied_handler: Rapsys\BlogBundle\Handler\AccessDeniedHandler + + # Remember me + #XXX: see https://symfony.com/doc/current/security/remember_me.html + remember_me: + # Use APP_SECRET + secret: '%kernel.secret%' + # Always remember me + always_remember_me: true + + # Set password hashers + password_hashers: + #XXX: comment this key in config/security.yaml to prevent users_in_memory induced failures + #TODO: see https://symfony.com/doc/current/security/passwords.html (sodium ? + upgrade) + Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: + #Rapsys\TreeBundle\Entity\User: + algorithm: 'sodium' + migrate_from: + - 'bcrypt' + - 'plaintext' + + # Set providers + providers: + database: + entity: + class: 'Rapsys\TreeBundle\Entity\User' + property: 'mail' + + # Set role hierarchy + role_hierarchy: + ROLE_USER: [ 'ROLE_GUEST' ] + ROLE_ADMIN: [ 'ROLE_GUEST', 'ROLE_USER' ] + +# Services configuration +services: + # Register tree controller + Rapsys\TreeBundle\Controller\TreeController: + arguments: [ '@service_container', '@router', '@request_stack', '@translator', '@twig' ] + tags: [ 'controller.service_arguments' ] + # Register tree repository factory + Rapsys\TreeBundle\Factory: + arguments: [ '@service_container', '@request_stack', '@router', '@rapsyspack.slugger_util', '@translator', '%rapsystree.locale%', '%rapsystree.languages%' ] + #Register blog fixture + Rapsys\TreeBundle\Fixture\TreeFixture: + arguments: [ '@service_container' ] + tags: [ 'doctrine.fixture.orm' ] + +# Twig Configuration +twig: + # Enforce debug + #auto_reload: ~ + debug: '%kernel.debug%' + #strict_variables: '%kernel.debug%' + + # Disable cache + # XXX: enable forced regeneration of css and js at each page load + cache: false + + # Fix form layout for css + # XXX: @RapsysTree is a shortcut to vendor/rapsys/treebundle/Resources/views directory here + #form_theme: [ '@RapsysTree/form/form_div_layout.html.twig' ] + + # Set twig paths + paths: + # Required by email.image(site_logo) directive + # XXX: Allow twig to resolve @RapsysTree/png/logo.png in vendor/rapsys/treebundle/public/png/logo.png + '%kernel.project_dir%/vendor/rapsys/treebundle/public': 'RapsysTree' + #'%kernel.project_dir%/vendor/rapsys/userbundle/public': 'RapsysUser' + # Override default exception controller + #exception_controller: Rapsys\TreeBundle\Controller\ErrorController::preview