Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/sylius.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ jobs:
- 8.2
- 8.3
sylius:
- 1.12.0
- 1.13.0
- 1.14.0
- 2.0
symfony:
- 6.4
- 7.2
node:
- 14.x
- 20.x
env:
APP_ENV: test
package-name: synolia/sylius-admin-oauth-plugin
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ in `install/Application/.env.local` and/or `install/Application/.env.test.local`
$ make install -e SYLIUS_VERSION=XX SYMFONY_VERSION=YY PHP_VERSION=ZZ
```

Default values : XX=1.12.0 and YY=6.3 and ZZ=8.2
Default values : XX=2.0.0 and YY=7.2 and ZZ=8.2

:information_source: To reset (drop database and delete files) test environment:
```bash
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ CONSOLE=cd ${TEST_DIRECTORY} && php bin/console -e test
COMPOSER=cd ${TEST_DIRECTORY} && composer
YARN=cd ${TEST_DIRECTORY} && yarn

SYLIUS_VERSION=1.14
SYMFONY_VERSION=6.4
SYLIUS_VERSION=2.0
SYMFONY_VERSION=7.2
PHP_VERSION=8.2
PLUGIN_NAME=synolia/sylius-admin-oauth-plugin

###
### DEVELOPMENT
### ¯¯¯¯¯¯¯¯¯¯¯

install: sylius ## Install Plugin on Sylius [SYLIUS_VERSION=1.12.0] [SYMFONY_VERSION=6.1] [PHP_VERSION=8.1]
install: sylius ## Install Plugin on Sylius [SYLIUS_VERSION=2.0.0] [SYMFONY_VERSION=7.2] [PHP_VERSION=8.2]
.PHONY: install

reset: ## Remove dependencies
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

## Requirements

| | Version |
|:-------|:--------|
| PHP | ^8.2 |
| Sylius | ^1.12 |
| | Version |
|:-------|:--------------|
| PHP | ^8.2 |
| Sylius | ^1.12 or ^2.0 |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new Tag created with this new version will no longer be compatible with Sylius 1.12 (because of composer.json).
I think we can therefore withdraw version 1.12.


## Installation

Expand All @@ -45,7 +45,6 @@
3. In your security.yaml, add the OAuth authenticator in your admin firewall and put access_control paths you need depending on wich provider you use. **They must be on top of the others** :
```yaml
security:
enable_authenticator_manager: true
firewalls:
admin:
custom_authenticators:
Expand All @@ -62,13 +61,14 @@
4. Create a config/routes/synolia_oauth.yaml to configure plugin's routes and to prefix them with 'admin':
```yaml
synolia_oauth:
resource: '@SynoliaSyliusAdminOauthPlugin/config/routes.yaml'
resource: '@SynoliaSyliusAdminOauthPlugin/config/routes[-legacy].yaml'
prefix: '/%sylius_admin.path_name%'
```
5. Create a config/packages/synolia_oauth_config.yaml to import all required configs :
5. Create a config/packages/synolia_oauth_config.yaml to import all required configs
depending on which sylius version you use:
```yaml
imports:
- { resource: "@SynoliaSyliusAdminOauthPlugin/config/app.yaml" }
- { resource: "@SynoliaSyliusAdminOauthPlugin/config/app[-legacy].yaml" }
```

6. Add this trait to your App\Entity\User\AdminUser.php
Expand Down
44 changes: 22 additions & 22 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,32 @@
"php": "^8.2",
"knpuniversity/oauth2-client-bundle": "^2.18",
"league/oauth2-google": "^4.0",
"sylius/sylius": "^1.12",
"sylius/sylius": "^2.0",
"thenetworg/oauth2-azure": "^2.2",
"webmozart/assert": "^1.11"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.66",
"friendsoftwig/twigcs": "^6.5",
"j13k/yaml-lint": "^1.1",
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpmd/phpmd": "^2.15",
"phpro/grumphp": "^2.9",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-doctrine": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-strict-rules": "^2.0",
"phpstan/phpstan-webmozart-assert": "^2.0",
"phpunit/phpunit": "^9.5",
"povils/phpmnd": "^3.5",
"rector/rector": "^2.0",
"seld/jsonlint": "^1.11",
"squizlabs/php_codesniffer": "^3.11",
"sylius-labs/coding-standard": "^4.3",
"symfony/browser-kit": "^6.4",
"symfony/debug-bundle": "^6.4",
"symfony/dotenv": "^6.4"
"friendsofphp/php-cs-fixer": "3.66.0",
"friendsoftwig/twigcs": "6.5.0",
"j13k/yaml-lint": "1.1.6",
"php-parallel-lint/php-parallel-lint": "1.4.0",
"phpmd/phpmd": "2.15.0",
"phpro/grumphp": "2.10.0",
"phpstan/extension-installer": "1.4.3",
"phpstan/phpstan": "2.0.4",
"phpstan/phpstan-doctrine": "2.0.1",
"phpstan/phpstan-phpunit": "2.0.3",
"phpstan/phpstan-strict-rules": "2.0.1",
"phpstan/phpstan-webmozart-assert": "2.0.0",
"phpunit/phpunit": "9.6.22",
"povils/phpmnd": "3.5.0",
"rector/rector": "2.0.4",
"seld/jsonlint": "1.11.0",
"squizlabs/php_codesniffer": "3.11.2",
"sylius-labs/coding-standard": "4.4.0",
"symfony/browser-kit": "6.4.13",
"symfony/debug-bundle": "6.4.13",
"symfony/dotenv": "6.4.16"
},
"config": {
"sort-packages": true,
Expand Down
3 changes: 3 additions & 0 deletions config/app-legacy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
imports:
- { resource: "legacy/*.yaml" }
- { resource: "ui/*.yaml" }
100 changes: 5 additions & 95 deletions config/app.yaml
Original file line number Diff line number Diff line change
@@ -1,95 +1,5 @@
sylius_ui:
events:
sylius.admin.login.form.content:
blocks:
alerts: '@SynoliaSyliusAdminOauthPlugin/alerts.html.twig'
google_oauth_button: '@SynoliaSyliusAdminOauthPlugin/google_auth_button.html.twig'
microsoft_oauth_button: '@SynoliaSyliusAdminOauthPlugin/microsoft_auth_button.html.twig'
sylius.admin.layout.stylesheets:
blocks:
stylesoauth:
template: "@SynoliaSyliusAdminOauthPlugin/_styles.html.twig"
enabled: true

twig:
globals:
google_client_id: '%env(default::SYNOLIA_ADMIN_OAUTH_GOOGLE_CLIENT_ID)%'
microsoft_client_id: '%env(default::SYNOLIA_ADMIN_OAUTH_MICROSOFT_CLIENT_ID)%'

knpu_oauth2_client:
clients:
google_admin:
type: google
client_id: '%env(default::SYNOLIA_ADMIN_OAUTH_GOOGLE_CLIENT_ID)%'
client_secret: '%env(default::SYNOLIA_ADMIN_OAUTH_GOOGLE_CLIENT_SECRET)%'
redirect_route: 'connect_admin_google_check'
redirect_params: {}
azure_admin:
type: azure
client_id: '%env(default::SYNOLIA_ADMIN_OAUTH_MICROSOFT_CLIENT_ID)%'
client_secret: '%env(default::SYNOLIA_ADMIN_OAUTH_MICROSOFT_CLIENT_SECRET)%'
redirect_route: 'connect_admin_microsoft_check'
redirect_params: {}

winzou_state_machine:
synolia_admin_oauth_authorized_domain:
class: "%synolia_admin_oauth.model.authorized_domain.class%"
property_path: isEnabled
graph: synolia_admin_oauth_authorized_domain
state_machine_class: "%sylius.state_machine.class%"
states:
new: ~
enabled: ~
transitions:
enable:
from: [new]
to: enabled
sylius_grid:
grids:
synolia_admin_oauth_authorized_domain:
driver:
options:
class: "%synolia_admin_oauth.model.authorized_domain.class%"
sorting:
name: asc
isEnabled: asc
fields:
name:
type: string
label: sylius.ui.name
sortable: ~
isEnabled:
type: twig
label: sylius.ui.is_enabled
options:
template: "@SynoliaSyliusAdminOauthPlugin/state.html.twig"
vars:
labels: "AuthorizedDomain/Label/Status"
sortable: ~
actions:
main:
create:
type: create
item:
update:
type: update
delete:
type: delete
enable:
type: apply_transition
label: sylius.ui.enable
icon: star
options:
link:
route: app_admin_authorized_domain_trust
parameters:
id: resource.id
transition: enable
graph: app_authorized_domain
class: yellow
bulk:
delete:
type: delete
filters:
name:
type: string
imports:
- { resource: "legacy/knpu-oauth2-client.yaml" }
- { resource: "legacy/twig.yaml" }
- { resource: "grid/authorized-domain.yaml" }
- { resource: "twig_hooks/*.yaml" }
35 changes: 35 additions & 0 deletions config/grid/authorized-domain.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
sylius_grid:
grids:
synolia_admin_oauth_authorized_domain:
driver:
options:
class: "%synolia_admin_oauth.model.authorized_domain.class%"
sorting:
name: asc
isEnabled: asc
fields:
name:
type: string
label: sylius.ui.name
sortable: ~
isEnabled:
type: twig
label: sylius.ui.is_enabled
options:
template: "@SynoliaSyliusAdminOauthPlugin/admin/grid/authorized_domain/is_enabled.html.twig"
sortable: ~
actions:
main:
create:
type: create
item:
update:
type: update
delete:
type: delete
bulk:
delete:
type: delete
filters:
name:
type: string
37 changes: 37 additions & 0 deletions config/legacy/grid.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
sylius_grid:
grids:
synolia_admin_oauth_authorized_domain:
driver:
options:
class: "%synolia_admin_oauth.model.authorized_domain.class%"
sorting:
name: asc
isEnabled: asc
fields:
name:
type: string
label: sylius.ui.name
sortable: ~
isEnabled:
type: twig
label: sylius.ui.is_enabled
options:
template: "@SynoliaSyliusAdminOauthPlugin/state.html.twig"
vars:
labels: "AuthorizedDomain/Label/Status"
sortable: ~
actions:
main:
create:
type: create
item:
update:
type: update
delete:
type: delete
bulk:
delete:
type: delete
filters:
name:
type: string
14 changes: 14 additions & 0 deletions config/legacy/knpu-oauth2-client.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
knpu_oauth2_client:
clients:
google_admin:
type: google
client_id: '%env(default::SYNOLIA_ADMIN_OAUTH_GOOGLE_CLIENT_ID)%'
client_secret: '%env(default::SYNOLIA_ADMIN_OAUTH_GOOGLE_CLIENT_SECRET)%'
redirect_route: 'connect_admin_google_check'
redirect_params: {}
azure_admin:
type: azure
client_id: '%env(default::SYNOLIA_ADMIN_OAUTH_MICROSOFT_CLIENT_ID)%'
client_secret: '%env(default::SYNOLIA_ADMIN_OAUTH_MICROSOFT_CLIENT_SECRET)%'
redirect_route: 'connect_admin_microsoft_check'
redirect_params: {}
4 changes: 4 additions & 0 deletions config/legacy/twig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
twig:
globals:
google_client_id: '%env(default::SYNOLIA_ADMIN_OAUTH_GOOGLE_CLIENT_ID)%'
microsoft_client_id: '%env(default::SYNOLIA_ADMIN_OAUTH_MICROSOFT_CLIENT_ID)%'
21 changes: 21 additions & 0 deletions config/routes-legacy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
controllers:
resource:
path: ../src/Controller/
namespace: Synolia\SyliusAdminOauthPlugin\Controller
type: attribute

synolia_admin_oauth_authorized_domain:
resource: |
alias: synolia_admin_oauth.authorized_domain
section: admin
templates: "@SyliusAdmin\\Crud"
redirect: index
grid: synolia_admin_oauth_authorized_domain
vars:
all:
header: synolia.sylius_admin_oauth.ui.authorized_domains.title
subheader: synolia.sylius_admin_oauth.ui.authorized_domains.subheader
breadcrumb: synolia.sylius_admin_oauth.ui.authorized_domains.menu_label
index:
icon: 'file image outline'
type: sylius.resource
9 changes: 1 addition & 8 deletions config/routes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@ synolia_admin_oauth_authorized_domain:
resource: |
alias: synolia_admin_oauth.authorized_domain
section: admin
templates: "@SyliusAdmin\\Crud"
templates: "@SyliusAdmin\\shared\\crud"
redirect: index
grid: synolia_admin_oauth_authorized_domain
vars:
all:
header: synolia.sylius_admin_oauth.ui.authorized_domains.title
subheader: synolia.sylius_admin_oauth.ui.authorized_domains.subheader
breadcrumb: synolia.sylius_admin_oauth.ui.authorized_domains.menu_label
index:
icon: 'file image outline'
type: sylius.resource
Loading