WIP: Upgrade skeleton to symfony 5 #18

Draft
julienfastre wants to merge 47 commits from upgrade-sf5 into main
20 changed files with 137 additions and 199 deletions
Showing only changes of commit bf29c7756f - Show all commits

View File

@ -0,0 +1,14 @@
framework:
cache:
default_redis_provider: '%env(resolve:REDIS_URL)%'
pools:
cache.user_data:
adapter: cache.adapter.redis
public: true
default_lifetime: 300 # 5 minutes
# will be used in chill_main.tag_aware_cache service
cache.tags:
adapter: cache.adapter.redis
public: false
default_lifetime: 300

View File

@ -27,6 +27,12 @@ chill_main:
y: '%env(float:ADD_ADDRESS_MAP_CENTER_Y)%' y: '%env(float:ADD_ADDRESS_MAP_CENTER_Y)%'
z: '%env(float:ADD_ADDRESS_MAP_CENTER_Z)%' z: '%env(float:ADD_ADDRESS_MAP_CENTER_Z)%'
when@test:
chill_main:
available_languages:
- 'fr'
- 'en'
chill_custom_fields: chill_custom_fields:
show_empty_values_in_views: false show_empty_values_in_views: false

View File

@ -1,88 +0,0 @@
chill_main:
cruds:
-
class: 'App\Entity\VendeePerson'
controller: 'App\Controller\VendeePersonController'
name: vendeeperson
base_path: /vendee/vendeeperson
actions:
infosociopro_edit:
controller_action: 'infosocioproEdit'
path: '/{id}/infosociopro/edit'
role: CHILL_PERSON_EDIT
infosociopro_view:
controller_action: 'infosocioproView'
path: '/{id}/infosociopro/view'
role: CHILL_PERSON_VIEW
entourage_edit:
controller_action: 'entourageEdit'
path: '/{id}/entourage/edit'
role: CHILL_PERSON_EDIT
entourage_view:
controller_action: 'entourageView'
path: '/{id}/entourage/view'
role: CHILL_PERSON_VIEW
infomedicale_edit:
controller_action: 'infomedicaleEdit'
path: '/{id}/infomedicale/edit'
role: CHILL_PERSON_EDIT
infomedicale_view:
controller_action: 'infomedicaleView'
path: '/{id}/infomedicale/view'
role: CHILL_PERSON_VIEW
infologement_edit:
controller_action: 'infologementEdit'
path: '/{id}/infologement/edit'
role: CHILL_PERSON_EDIT
infologement_view:
controller_action: 'infologementView'
path: '/{id}/infologement/view'
role: CHILL_PERSON_VIEW
-
class: 'App\Entity\VendeePersonMineur'
controller: 'App\Controller\VendeePersonMineurController'
name: vendeepersonmineur
base_path: /vendee/vendeepersonmineur
actions:
infofamille_edit:
controller_action: 'infofamilleEdit'
path: '/{id}/infofamille/edit'
role: CHILL_PERSON_EDIT
infofamille_view:
controller_action: 'infofamilleView'
path: '/{id}/infofamille/view'
role: CHILL_PERSON_VIEW
scolarite_edit:
controller_action: 'scolariteEdit'
path: '/{id}/scolarite/edit'
role: CHILL_PERSON_EDIT
scolarite_view:
controller_action: 'scolariteView'
path: '/{id}/scolarite/view'
role: CHILL_PERSON_VIEW
infomedicale_edit:
controller_action: 'infomedicaleEdit'
path: '/{id}/infomedicale/edit'
role: CHILL_PERSON_EDIT
infomedicale_view:
controller_action: 'infomedicaleView'
path: '/{id}/infomedicale/view'
role: CHILL_PERSON_VIEW
-
class: 'App\Entity\Security\Profile'
name: vendee_security_profile
base_path: '/admin/vendee/security/profile'
base_role: ROLE_ADMIN
form_class: 'App\Form\Security\ProfileType'
controller: 'App\Controller\SecurityProfileController'
actions:
index:
template: '/Security/Profile/index.html.twig'
role: ROLE_ADMIN
new:
role: ROLE_ADMIN
template: '/Security/Profile/new.html.twig'
edit:
role: ROLE_ADMIN
template: '/Security/Profile/edit.html.twig'

View File

@ -1,3 +0,0 @@
twig:
globals:
responsive_debug: false

View File

@ -2,25 +2,9 @@ doctrine_migrations:
migrations_paths: migrations_paths:
# migrations for custom modules # migrations for custom modules
'Application\Migrations': '%kernel.project_dir%/migrations' 'Application\Migrations': '%kernel.project_dir%/migrations'
# migrations for default chill modules
'Chill\Migrations\Main': '@ChillMainBundle/migrations'
'Chill\Migrations\Activity': '@ChillActivityBundle/migrations'
'Chill\Migrations\DocStore': '@ChillDocStoreBundle/migrations'
'Chill\Migrations\CustomFields': '@ChillCustomFieldsBundle/migrations'
'Chill\Migrations\Event': '@ChillEventBundle/migrations'
'Chill\Migrations\Person': '@ChillPersonBundle/migrations'
'Chill\Migrations\Task': '@ChillTaskBundle/migrations'
'Chill\Migrations\ThirdParty': '@ChillThirdPartyBundle/migrations'
'Chill\Migrations\DocGenerator': '@ChillDocGeneratorBundle/migrations'
'Chill\Migrations\AsideActivity': '@ChillAsideActivityBundle/migrations'
'Chill\Migrations\Calendar': '@ChillCalendarBundle/migrations'
'Chill\Migrations\Budget': '@ChillBudgetBundle/migrations'
all_or_nothing: all_or_nothing:
true true
services:
'Doctrine\Migrations\Version\Comparator': 'Chill\MainBundle\Doctrine\Migrations\VersionComparator'
storage: storage:
table_storage: table_storage:
table_name: 'migration_versions' table_name: 'migration_versions'

View File

@ -0,0 +1,20 @@
doctrine_migrations:
migrations_paths:
# migrations for default chill modules
'Chill\Migrations\Main': '@ChillMainBundle/migrations'
'Chill\Migrations\Activity': '@ChillActivityBundle/migrations'
'Chill\Migrations\DocStore': '@ChillDocStoreBundle/migrations'
'Chill\Migrations\CustomFields': '@ChillCustomFieldsBundle/migrations'
'Chill\Migrations\Event': '@ChillEventBundle/migrations'
'Chill\Migrations\Person': '@ChillPersonBundle/migrations'
'Chill\Migrations\Task': '@ChillTaskBundle/migrations'
'Chill\Migrations\ThirdParty': '@ChillThirdPartyBundle/migrations'
'Chill\Migrations\DocGenerator': '@ChillDocGeneratorBundle/migrations'
'Chill\Migrations\AsideActivity': '@ChillAsideActivityBundle/migrations'
'Chill\Migrations\Calendar': '@ChillCalendarBundle/migrations'
'Chill\Migrations\Budget': '@ChillBudgetBundle/migrations'
all_or_nothing:
true
services:
'Doctrine\Migrations\Version\Comparator': 'Chill\MainBundle\Doctrine\Migrations\VersionComparator'

View File

@ -7,8 +7,6 @@ framework:
verify_peer: false verify_peer: false
verify_host: false verify_host: false
# DIRTY FIX un bug dans symfony4 empêche de récupérer un tableau de variables depuis .env
# cfr. https://github.com/symfony/symfony/issues/28599
trusted_hosts: trusted_hosts:
- '^(localhost|127.0.0.1|web)$' - '^(localhost|127.0.0.1|web)$'
- '%env(resolve:TRUSTED_HOSTS)%' - '%env(resolve:TRUSTED_HOSTS)%'
@ -31,10 +29,6 @@ framework:
#error_controller: App\Controller\ErrorController::show #error_controller: App\Controller\ErrorController::show
## sf4 check: ou à déplacer dans un chill.yaml
assets:
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
when@test: when@test:
framework: framework:
test: true test: true

View File

@ -0,0 +1,3 @@
framework:
assets:
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'

View File

@ -0,0 +1,4 @@
framework:
mailer:
envelope:
sender: '%env(NOTIFICATION_FROM_EMAIL)%'

View File

@ -17,11 +17,3 @@ framework:
routing: routing:
# Route your messages to the transports # Route your messages to the transports
# 'App\Message\YourMessage': async # 'App\Message\YourMessage': async
'Chill\CalendarBundle\Messenger\Message\CalendarRangeMessage': async
'Chill\CalendarBundle\Messenger\Message\CalendarRangeRemovedMessage': async
'Chill\CalendarBundle\Messenger\Message\CalendarRemovedMessage': async
'Chill\CalendarBundle\Messenger\Message\CalendarMessage': async
'Chill\CalendarBundle\Messenger\Message\InviteUpdateMessage': async
'Chill\CalendarBundle\Messenger\Message\MSGraphChangeNotificationMessage': async
'Chill\MainBundle\Service\ShortMessage\ShortMessage': async
'Chill\DocGeneratorBundle\Service\Messenger\RequestGenerationMessage': priority

View File

@ -0,0 +1,13 @@
framework:
messenger:
routing:
# Route your messages to the transports
# 'App\Message\YourMessage': async
'Chill\CalendarBundle\Messenger\Message\CalendarRangeMessage': async
'Chill\CalendarBundle\Messenger\Message\CalendarRangeRemovedMessage': async
'Chill\CalendarBundle\Messenger\Message\CalendarRemovedMessage': async
'Chill\CalendarBundle\Messenger\Message\CalendarMessage': async
'Chill\CalendarBundle\Messenger\Message\InviteUpdateMessage': async
'Chill\CalendarBundle\Messenger\Message\MSGraphChangeNotificationMessage': async
'Chill\MainBundle\Service\ShortMessage\ShortMessage': async
'Chill\DocGeneratorBundle\Service\Messenger\RequestGenerationMessage': priority

View File

@ -1,9 +1,4 @@
security: security:
access_decision_manager:
strategy: unanimous
allow_if_all_abstain: false
enable_authenticator_manager: true enable_authenticator_manager: true
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
password_hashers: password_hashers:
@ -12,66 +7,24 @@ security:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers: providers:
chain_provider: # providers added by chill-bundles recipes
chain : # those providers are required to make chill working
providers: [in_memory, users] chill_chain_provider:
in_memory: chain:
providers: [chill_in_memory, chill_users]
chill_in_memory:
memory: memory:
users: users:
admin: { password: '%env(resolve:ADMIN_PASSWORD)%', roles: ['ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH', 'ROLE_USER'] } admin: { password: '%env(resolve:ADMIN_PASSWORD)%', roles: ['ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH', 'ROLE_USER'] }
users: chill_users:
id: chill.main.user_provider id: chill.main.user_provider
encoders: # end of providers added by chill-bundles recipes
Chill\MainBundle\Entity\User: auto # all other providers might be removed, unless you have specific needs
Symfony\Component\Security\Core\User\User: plaintext # TODO AFTER CHILL-BUNDLES RECIPES INSTALL: remove the user providers which are not used
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
wopi:
pattern: ^/wopi
provider: chain_provider
stateless: true
guard:
authenticators:
- lexik_jwt_authentication.jwt_token_authenticator
main:
# remove during upgrade from symfony 4 to symfony 5 TODO check this
#anonymous: ~
provider: chain_provider
form_login:
csrf_parameter: _csrf_token
csrf_token_id: authenticate
#csrf_provider: security.csrf.token_manager
# remove during upgrade from symfony 4 to symfony 5 TODO check this
# logout_on_user_change: true
logout:
path: /logout
# uncomment to enable impersonate mode in Chill
# https://symfony.com/doc/current/security/impersonating_user.html
switch_user: true
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#firewalls-authentication
# Easy way to control access for large sections of your site # Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used # Note: Only the *first* access control that matches will be used
access_control:
- { path: ^/saml/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/saml/metadata, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/(login|logout), roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/public, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/wopi, roles: IS_AUTHENTICATED_FULLY }
# access for homepage, the homepage redirect admin to admin section
- { path: ^/$, roles: [ IS_AUTHENTICATED_REMEMBERED ] }
- { path: ^/homepage$, roles: [ IS_AUTHENTICATED_REMEMBERED ] }
# idem
- { path: ^/([a-z]+/)?homepage, roles: [ IS_AUTHENTICATED_REMEMBERED ] }
# admin section, only for admin
- { path: ^/([a-z]+/)?admin, roles: ROLE_ADMIN }
# other pages, only for regular user (no admin)
- { path: ^/, roles: ROLE_USER }
when@test: when@test:
security: security:

View File

@ -0,0 +1,50 @@
security:
access_decision_manager:
strategy: unanimous
allow_if_all_abstain: false
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
wopi:
pattern: ^/wopi
provider: chill_chain_provider
stateless: true
guard:
authenticators:
- lexik_jwt_authentication.jwt_token_authenticator
chill_main:
# remove during upgrade from symfony 4 to symfony 5 TODO check this
#anonymous: ~
provider: chill_chain_provider
form_login:
csrf_parameter: _csrf_token
csrf_token_id: authenticate
#csrf_provider: security.csrf.token_manager
# remove during upgrade from symfony 4 to symfony 5 TODO check this
# logout_on_user_change: true
logout:
path: /logout
# uncomment to enable impersonate mode in Chill
# https://symfony.com/doc/current/security/impersonating_user.html
switch_user: true
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#firewalls-authentication
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
- { path: ^/(login|logout), roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/public, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/wopi, roles: IS_AUTHENTICATED_FULLY }
# access for homepage, the homepage redirect admin to admin section
- { path: ^/$, roles: [ IS_AUTHENTICATED_REMEMBERED ] }
- { path: ^/homepage$, roles: [ IS_AUTHENTICATED_REMEMBERED ] }
# idem
- { path: ^/([a-z]+/)?homepage, roles: [ IS_AUTHENTICATED_REMEMBERED ] }
# admin section, only for admin
- { path: ^/([a-z]+/)?admin, roles: ROLE_ADMIN }
# other pages, only for regular user (no admin)
- { path: ^/, roles: ROLE_USER }

View File

View File

@ -1,5 +0,0 @@
---
chill_main:
available_languages:
- 'fr'
- 'en'

View File

@ -1,8 +1,5 @@
--- ---
# config/packages/test/security.yaml # config/packages/test/security.yaml
security: security:
firewalls:
default:
http_basic: ~
role_hierarchy: role_hierarchy:
CHILL_MASTER_ROLE: [CHILL_INHERITED_ROLE_1] CHILL_MASTER_ROLE: [CHILL_INHERITED_ROLE_1]

View File

@ -1,18 +1,5 @@
twig: twig:
default_path: '%kernel.project_dir%/templates' default_path: '%kernel.project_dir%/templates'
## In Symfony 5, bootstrap_5 theme is supported. But not yet in sf4 !!
# see sf5 https://symfony.com/doc/current/form/form_themes.html
# see sf4 https://symfony.com/doc/4.4/form/form_themes.html
#
# While waiting for the upgrade, we get the form theme file
# (https://github.com/symfony/symfony/tree/5.4/src/Symfony/Bridge/Twig/Resources/views/Form),
# put it in ChillMainBundle/Resources/views/Form/bootstrap5/
# and adapt it lightly.
#
form_themes: ['@ChillMain/Form/bootstrap5/bootstrap_5_horizontal_layout.html.twig']
#form_themes: ['bootstrap_5_horizontal_layout.html.twig']
when@test: when@test:
twig: twig:
strict_variables: true strict_variables: true

View File

@ -0,0 +1,16 @@
twig:
## In Symfony 5, bootstrap_5 theme is supported. But not yet in sf4 !!
# see sf5 https://symfony.com/doc/current/form/form_themes.html
# see sf4 https://symfony.com/doc/4.4/form/form_themes.html
#
# While waiting for the upgrade, we get the form theme file
# (https://github.com/symfony/symfony/tree/5.4/src/Symfony/Bridge/Twig/Resources/views/Form),
# put it in ChillMainBundle/Resources/views/Form/bootstrap5/
# and adapt it lightly.
#
form_themes: ['@ChillMain/Form/bootstrap5/bootstrap_5_horizontal_layout.html.twig']
when@dev:
twig:
globals:
responsive_debug: false

View File

@ -41,6 +41,7 @@ if [ "${APP_ENV}" = "prod" ]; then
php /var/www/app/bin/console doctrine:migrations:status php /var/www/app/bin/console doctrine:migrations:status
php /var/www/app/bin/console doctrine:migrations:migrate -n php /var/www/app/bin/console doctrine:migrations:migrate -n
php /var/www/app/bin/console messenger:setup-transports php /var/www/app/bin/console messenger:setup-transports
php /var/www/app/bin/console chill:db:sync-views
fi fi
fi fi