Skip to content

Commit

Permalink
WIP: Migrate to Brevo SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
BadPixxel committed Sep 27, 2023
1 parent 8d71ea0 commit 0bd039c
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/config/packages/brevo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

brevo_bridge:

api_key: "%env(string:BREVO_API_KEY)%"
track_key: "%env(string:BREVO_TRACKING_KEY)%"
disable_emails: true

mjml:
api_key: "%env(string:MJML_API_KEY)%"
secret_key: "%env(string:MJML_API_SECRET)%"

sender:
name: "Brevo Bridge Bundle"
email: "[email protected]"

reply:
name: "Brevo Bridge Bundle"
email: "[email protected]"

storage:
user: UserBundle\Entity\User
emails: BadPixxel\BrevoBridge\Tests\Bundle\Entity\Email
sms: BadPixxel\BrevoBridge\Tests\Bundle\Entity\Sms

emails:
# Basic Notification Email
Basic: BadPixxel\BrevoBridge\Tests\Bundle\Emails\Basic
# Templated Email
Template: BadPixxel\BrevoBridge\Tests\Bundle\Emails\Template
10 changes: 10 additions & 0 deletions tests/config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
parameters:
# Adds a fallback DATABASE_URL if the env var is not set.
env(DATABASE_URL): 'sqlite:///%kernel.project_dir%/var/data.db'

doctrine:
dbal:
url: '%env(resolve:DATABASE_URL)%'
orm:
auto_generate_proxy_classes: '%kernel.debug%'
auto_mapping: true
24 changes: 24 additions & 0 deletions tests/config/packages/framework.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
parameters:
locale: 'en'
# Adds a fallback DATABASE_URL if the env var is not set.
env(APP_SECRET): 'pu65!#$QunyXfgEETyFpg9sLt!4cSyH2'
env(MAILER_DSN): 'null://localhost'

framework:
secret: '%env(APP_SECRET)%'
form: ~
property_access: ~
assets: ~
default_locale: '%locale%'
translator:
default_path: '%kernel.project_dir%/translations'
fallbacks:
- '%locale%'
# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
session:
handler_id: ~
router:
strict_requirements: true
mailer:
dsn: '%env(MAILER_DSN)%'
43 changes: 43 additions & 0 deletions tests/config/packages/security.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
security:
enable_authenticator_manager: true

# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
role_hierarchy:
ROLE_ADMIN: [ROLE_USER, ROLE_SONATA_ADMIN]
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]

password_hashers:
Sonata\UserBundle\Model\UserInterface: auto

providers:
sonata_user_bundle:
id: sonata.user.security.user_provider

firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false

main:
lazy: true
pattern: /
provider: sonata_user_bundle
context: user
form_login:
login_path: sonata_user_admin_security_login
check_path: sonata_user_admin_security_check
default_target_path: sonata_admin_dashboard
logout:
path: sonata_user_admin_security_logout
target: sonata_user_admin_security_login
remember_me:
secret: '%env(APP_SECRET)%'
lifetime: 2629746
path: /

# 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$, role: PUBLIC_ACCESS }
- { path: ^/resetting, role: PUBLIC_ACCESS }
- { path: ^/, role: ROLE_USER }
15 changes: 15 additions & 0 deletions tests/config/packages/sonata_admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Sonata Admin
sonata_admin:
title: Brevo Bridge
search: false
dashboard:
blocks:
- { type: sonata.admin.block.admin_list, position: center }
options:
security:
role_admin: ROLE_USER

sonata_block:
blocks:
sonata.admin.block.admin_list:
contexts: [admin]
7 changes: 7 additions & 0 deletions tests/config/packages/sonata_user.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sonata_user:
class:
user: BadPixxel\BrevoBridge\Tests\Bundle\Entity\User
resetting:
email:
address: sonata@localhost
sender_name: Sonata Admin

0 comments on commit 0bd039c

Please sign in to comment.