Skip to content

Commit

Permalink
Pimcore 11 Support
Browse files Browse the repository at this point in the history
  • Loading branch information
solverat committed Sep 25, 2023
1 parent acd7ab1 commit 4b82d62
Show file tree
Hide file tree
Showing 67 changed files with 200 additions and 508 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ jobs:
matrix:
php: [ 8.2 ]
symfony: [ ^6.2 ]
pimcore: [ 11.0.8 ]
pimcore: [ ~11.0.0 ]
include:
- pimcore: 11.0.8
- pimcore: ~11.0.0
template_tag: v11.0.0
steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ jobs:
matrix:
php: [ 8.2 ]
symfony: [ ^6.2 ]
pimcore: [ 11.0.8 ]
pimcore: [ ~11.0.0 ]
include:
- pimcore: 11.0.8
- pimcore: ~11.0.0
template_tag: v11.0.0
steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/php-stan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ jobs:
matrix:
php: [ 8.2 ]
symfony: [ ^6.2 ]
pimcore: [ 11.0.8 ]
pimcore: [ ~11.0.0 ]
include:
- pimcore: 11.0.8
- pimcore: ~11.0.0
template_tag: v11.0.0
steps:
- uses: actions/checkout@v2
Expand Down
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ Add frontend user authentication and document restriction to pimcore.

| Release | Supported Pimcore Versions | Supported Symfony Versions | Release Date | Maintained | Branch |
|---------|-----------------------------------|----------------------------|--------------|----------------|----------|
| **4.x** | `10.5 - 10.6` | `5.4` | 22.11.2021 | Feature Branch | master |
| **3.x** | `6.0` - `6.8` | `3.4`, `^4.4` | 21.07.2019 | Feature Branch | 3.x |
| **2.5** | `5.4`, `5.5`, `5.6`, `5.7`, `5.8` | `3.4` | 18.07.2019 | Bugfix only | 2.5 |
| **5.x** | `11.0` | `6.2` | -- | Feature Branch | master |
| **4.x** | `10.5 - 10.6` | `5.4` | 22.11.2021 | Unsupported | 4.x |
| **3.x** | `6.0` - `6.8` | `3.4`, `^4.4` | 21.07.2019 | Unsupported | 3.x |
| **2.5** | `5.4`, `5.5`, `5.6`, `5.7`, `5.8` | `3.4` | 18.07.2019 | Unsupported | 2.5 |
| **1.5** | `4.0` | -- | 07.07.2017 | Unsupported | pimcore4 |

## Features
Expand All @@ -31,11 +32,17 @@ Please read the installation instructions before going deep with Members!

```json
"require" : {
"dachcom-digital/members" : "~4.1.0"
"dachcom-digital/members" : "~5.0.0"
}
```

- Execute: `$ bin/console pimcore:bundle:enable MembersBundle`
Add Bundle to `bundles.php`:
```php
return [
MembersBundle\MembersBundle::class => ['all' => true],
];
```

- Execute: `$ bin/console pimcore:bundle:install MembersBundle`

## Upgrading
Expand All @@ -50,13 +57,9 @@ bin/console members:install:class

### Security Installation
It is not possible to merge security configurations from multiple locations, including bundles. Instead, you have to move them to
one single config file, e.g. `config/packages/security.yaml`. Please adopt [security_auth_manager.yaml](./src/MembersBundle/Resources/config/packages/security_auth_manager.yaml)
one single config file, e.g. `config/packages/security.yaml`. Please adopt [security_auth_manager.yaml](./config/packages/security_auth_manager.yaml)
and merge your own firewall configuration into one single file.

#### Legacy Security Configuration
⚠️ If you still want to use the legacy authenticator, adopt [security_legacy.yaml](./src/MembersBundle/Resources/config/packages/security_legacy.yaml)
Keep in mind, that this configuration will be removed in Members 5.0.

### Route Installation
MembersBundle does not include any routes per default. Otherwise, it would be hard for you to change or override included routes.

Expand Down
4 changes: 4 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- [ROUTE] Route include changed from `@MembersBundle/Resources/pimcore/routing/all.yml` to `@MembersBundle/config/pimcore/routing/all.yaml`
- All template folder are lowercase/underscore now (`templates/change_password`, `templates/delete_account`)

### Deprecations
- Constant `MembersBundle\Security\RestrictionUri::PROTECTED_ASSET_FOLDER` has been removed
- Constant `MembersBundle\Security\RestrictionUri::MEMBERS_REQUEST_URL` has been removed

***

Members 4.x Upgrade Notes: https://github.com/dachcom-digital/pimcore-members/blob/4.x/UPGRADE.md
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
"phpstan/phpstan-symfony": "^1.0",
"symplify/easy-coding-standard": "^9.0"
},
"conflict": {
"league/csv": "9.11.0"
},
"suggest": {
"knpuniversity/oauth2-client-bundle": "^2.0"
}
Expand Down
2 changes: 0 additions & 2 deletions config/packages/security_auth_manager.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
security:

enable_authenticator_manager: true

# symfony default is set to "true".
# you may want to keep it "true" but keep in mind that this hide meaningful exceptions like "acount is disabled"
# instead the BadCredentialsException will be thrown
Expand Down
38 changes: 0 additions & 38 deletions config/packages/security_legacy.yaml

This file was deleted.

5 changes: 1 addition & 4 deletions src/Command/OAuthSetupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@ class OAuthSetupCommand extends Command
protected static $defaultName = 'members:oauth:setup';
protected static $defaultDescription = 'This command helps you the enhance Members with oauth2 connectors.';

protected bool $oauthEnabled;
protected ClassManagerInterface $classManager;
protected ClassInstaller $classInstaller;

public function __construct(bool $oauthEnabled)
public function __construct(protected bool $oauthEnabled)
{
$this->oauthEnabled = $oauthEnabled;

parent::__construct();
}

Expand Down
13 changes: 3 additions & 10 deletions src/Controller/Admin/RestrictionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,11 @@

class RestrictionController extends AdminAbstractController
{
protected Configuration $configuration;
protected ClassManagerInterface $classManager;
protected RestrictionService $restrictionService;

public function __construct(
Configuration $configuration,
ClassManagerInterface $classManager,
RestrictionService $restrictionService
protected Configuration $configuration,
protected ClassManagerInterface $classManager,
protected RestrictionService $restrictionService
) {
$this->configuration = $configuration;
$this->classManager = $classManager;
$this->restrictionService = $restrictionService;
}

public function getGlobalSettingsAction(): JsonResponse
Expand Down
7 changes: 2 additions & 5 deletions src/Controller/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;

class AuthController extends AbstractController
{
protected FactoryInterface $formFactory;

public function __construct(FactoryInterface $formFactory)
public function __construct(protected FactoryInterface $formFactory)
{
$this->formFactory = $formFactory;
}

public function loginAction(Request $request): Response
Expand Down
13 changes: 3 additions & 10 deletions src/Controller/ChangePasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,11 @@

class ChangePasswordController extends AbstractController
{
protected FactoryInterface $formFactory;
protected EventDispatcherInterface $eventDispatcher;
protected UserManagerInterface $userManager;

public function __construct(
FactoryInterface $formFactory,
EventDispatcherInterface $eventDispatcher,
UserManagerInterface $userManager
protected FactoryInterface $formFactory,
protected EventDispatcherInterface $eventDispatcher,
protected UserManagerInterface $userManager
) {
$this->formFactory = $formFactory;
$this->eventDispatcher = $eventDispatcher;
$this->userManager = $userManager;
}

public function changePasswordAction(Request $request): Response
Expand Down
13 changes: 3 additions & 10 deletions src/Controller/DeleteAccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,11 @@

class DeleteAccountController extends AbstractController
{
protected FactoryInterface $formFactory;
protected EventDispatcherInterface $eventDispatcher;
protected UserManagerInterface $userManager;

public function __construct(
FactoryInterface $formFactory,
EventDispatcherInterface $eventDispatcher,
UserManagerInterface $userManager
protected FactoryInterface $formFactory,
protected EventDispatcherInterface $eventDispatcher,
protected UserManagerInterface $userManager
) {
$this->formFactory = $formFactory;
$this->eventDispatcher = $eventDispatcher;
$this->userManager = $userManager;
}

public function deleteAccountAction(Request $request): Response
Expand Down
17 changes: 4 additions & 13 deletions src/Controller/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,12 @@

class ProfileController extends AbstractController
{
protected FactoryInterface $formFactory;
protected EventDispatcherInterface $eventDispatcher;
protected UserManagerInterface $userManager;
protected RequestHelper $requestHelper;

public function __construct(
FactoryInterface $formFactory,
EventDispatcherInterface $eventDispatcher,
UserManagerInterface $userManager,
RequestHelper $requestHelper
protected FactoryInterface $formFactory,
protected EventDispatcherInterface $eventDispatcher,
protected UserManagerInterface $userManager,
protected RequestHelper $requestHelper
) {
$this->formFactory = $formFactory;
$this->eventDispatcher = $eventDispatcher;
$this->userManager = $userManager;
$this->requestHelper = $requestHelper;
}

public function showAction(Request $request): Response
Expand Down
29 changes: 7 additions & 22 deletions src/Controller/ResettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,15 @@

class ResettingController extends AbstractController
{
protected FactoryInterface $requestResettingFormFactory;
protected FactoryInterface $resettingFormFactory;
protected EventDispatcherInterface $eventDispatcher;
protected UserManagerInterface $userManager;
protected TokenGeneratorInterface $tokenGenerator;
protected MailerInterface $mailer;
protected RequestHelper $requestHelper;

public function __construct(
FactoryInterface $requestResettingFormFactory,
FactoryInterface $resettingFormFactory,
EventDispatcherInterface $eventDispatcher,
UserManagerInterface $userManager,
TokenGeneratorInterface $tokenGenerator,
MailerInterface $mailer,
RequestHelper $requestHelper
protected FactoryInterface $requestResettingFormFactory,
protected FactoryInterface $resettingFormFactory,
protected EventDispatcherInterface $eventDispatcher,
protected UserManagerInterface $userManager,
protected TokenGeneratorInterface $tokenGenerator,
protected MailerInterface $mailer,
protected RequestHelper $requestHelper
) {
$this->requestResettingFormFactory = $requestResettingFormFactory;
$this->resettingFormFactory = $resettingFormFactory;
$this->eventDispatcher = $eventDispatcher;
$this->userManager = $userManager;
$this->tokenGenerator = $tokenGenerator;
$this->mailer = $mailer;
$this->requestHelper = $requestHelper;
}

public function requestAction(Request $request): Response
Expand Down
18 changes: 5 additions & 13 deletions src/Document/Builder/BrickBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Security;
use Symfony\Bundle\SecurityBundle\Security;
use Twig\Environment;

class BrickBuilder
{
protected string $sourceType = 'area';
protected TokenStorageInterface $tokenStorage;
protected IncludeRenderer $includeRenderer;
protected Environment $templateRenderer;
protected UrlGeneratorInterface $urlGenerator;
protected ?string $logoutUri = null;
protected bool $hideAfterLogin = false;
protected ?Document $redirectPage = null;
Expand All @@ -35,15 +31,11 @@ class BrickBuilder
];

public function __construct(
TokenStorageInterface $tokenStorage,
IncludeRenderer $includeRenderer,
Environment $templateRenderer,
UrlGeneratorInterface $urlGenerator
protected TokenStorageInterface $tokenStorage,
protected IncludeRenderer $includeRenderer,
protected Environment $templateRenderer,
protected UrlGeneratorInterface $urlGenerator
) {
$this->tokenStorage = $tokenStorage;
$this->includeRenderer = $includeRenderer;
$this->templateRenderer = $templateRenderer;
$this->urlGenerator = $urlGenerator;
}

public function setup(string $sourceType): self
Expand Down
10 changes: 4 additions & 6 deletions src/Event/FormEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@

class FormEvent extends Event
{
private FormInterface $form;
private Request $request;
private ?Response $response = null;

public function __construct(FormInterface $form, Request $request)
{
$this->form = $form;
$this->request = $request;
public function __construct(
private FormInterface $form,
private Request $request
) {
}

public function getForm(): FormInterface
Expand Down
11 changes: 4 additions & 7 deletions src/Event/OAuth/OAuthResourceEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@

class OAuthResourceEvent extends Event
{
protected UserInterface $user;
protected ResourceOwnerInterface $resourceOwner;

public function __construct(UserInterface $user, ResourceOwnerInterface $resourceOwner)
{
$this->resourceOwner = $resourceOwner;
$this->user = $user;
public function __construct(
protected UserInterface $user,
protected ResourceOwnerInterface $resourceOwner
) {
}

public function getUser(): UserInterface
Expand Down
Loading

0 comments on commit 4b82d62

Please sign in to comment.