Skip to content

Commit

Permalink
start migrating to PX (#159)
Browse files Browse the repository at this point in the history
* start migrating to PX
* improve symfony auth structure
* update class definitions, remove EmailUserProvider
* fix phpstan level4
* only allow array in PimcoreUniqueEntityValidator
* fix tests
* drop pimcore 10.1 support
* refurbish groupMultiSelect tag. resolves #143
* beautify validation exception
  • Loading branch information
solverat authored Nov 22, 2021
1 parent 479cc26 commit db8040a
Show file tree
Hide file tree
Showing 256 changed files with 3,295 additions and 6,380 deletions.
47 changes: 21 additions & 26 deletions .github/workflows/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ jobs:
env:
TEST_BUNDLE_NAME: "MembersBundle"
TEST_BUNDLE_INSTALLER_CLASS: "MembersBundle\\Tool\\Install"
TEST_BUNDLE_TEST_DIR: "${{ github.workspace }}/tests"
TEST_BUNDLE_TEST_DIR: "${{ github.workspace }}/lib/test-bundle/tests"
TEST_PROJECT_ROOT_DIR: "${{ github.workspace }}"

PIMCORE_CODECEPTION_FRAMEWORK: "${{ github.workspace }}/pimcore-codeception-framework"
PIMCORE_CODECEPTION_VERSION: "1.0"
PIMCORE_CODECEPTION_VERSION: "2.0"

PIMCORE_ENVIRONMENT: test
APP_ENV: test
PIMCORE_TEST_DB_DSN: "mysql://root:root@localhost/dachcom_bundle_test"
PIMCORE_TEST_URL: "http://localhost"
PIMCORE_CLASS_DIRECTORY: "${{ github.workspace }}/tests/_output/var/classes/DataObject"
PIMCORE_CLASS_DIRECTORY: "${{ github.workspace }}/lib/test-bundle/tests/_output/var/classes/DataObject"

SYMFONY_DEPRECATIONS_HELPER: "weak"
PIMCORE_PHP_ERROR_REPORTING: 32767
Expand All @@ -41,31 +41,28 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php: [7.4]
symfony: [^4.4]
pimcore: [~6.6.0, ~6.7.0, ~6.8.0]
php: [ 8.0 ]
symfony: [ ^5.3 ]
pimcore: [ ~10.2.0 ]
include:
- pimcore: ~6.6.0
template_tag: v2.6.0
- pimcore: ~6.7.0
template_tag: v2.7.0
- pimcore: ~6.8.0
template_tag: v2.8.0
- pimcore: ~6.8.0
symfony: ^3.4
php: 7.4
template_tag: v2.8.0
- pimcore: ~10.2.0
template_tag: v10.1.4
steps:
- uses: actions/checkout@v2
with:
path: lib/test-bundle

- name: Generate Application Structure
run: |
git clone -b ${{ matrix.template_tag }} --single-branch --depth 1 https://github.com/pimcore/skeleton.git
mv skeleton/app .
mv skeleton/composer.json .
mv skeleton/bin .
mv skeleton/config .
mv skeleton/public .
mv skeleton/src .
mv skeleton/templates .
mv skeleton/var .
mv skeleton/web .
mv skeleton/src/AppBundle src
rm -r skeleton
- name: Setup Pimcore Codeception Framework
env:
Expand Down Expand Up @@ -99,8 +96,6 @@ jobs:
- name: Setup MySql
run: |
mysql -uroot -h127.0.0.1 -proot -e "SET GLOBAL innodb_file_format=Barracuda;"
mysql -uroot -h127.0.0.1 -proot -e "SET GLOBAL innodb_large_prefix=1;"
mysql -uroot -h127.0.0.1 -proot -e "CREATE DATABASE dachcom_bundle_test CHARSET=utf8mb4;"
- name: Setup Chromium
Expand All @@ -110,7 +105,7 @@ jobs:
- name: Start Webserver and Chrome
run: |
wget https://get.symfony.com/cli/installer -O - | bash
~/.symfony/bin/symfony server:start --port=8080 --dir=web --force-php-discovery --allow-http --no-tls --daemon
~/.symfony/bin/symfony server:start --port=8080 --dir=public --force-php-discovery --allow-http --no-tls --daemon
- name: Get Composer Cache Directory
id: composer-cache
Expand All @@ -135,17 +130,17 @@ jobs:
- name: Assets Install
run: |
bin/console assets:install web --relative --symlink
bin/console assets:install public --relative --symlink
- name: Tests
run: |
bin/console cache:warmup --env=test
vendor/bin/codecept run --env github -c ${{ env.GITHUB_WORKSPACE }}
vendor/bin/codecept run --env github -c ${{ github.workspace }}/lib/test-bundle
- name: Log Output
uses: actions/upload-artifact@v2
if: failure()
with:
name: "Logs (PHP ${{ matrix.php }}, Pimcore ${{ matrix.pimcore }}, Symfony ${{ matrix.symfony }})"
path: tests/_output/
path: ${{ github.workspace }}/lib/test-bundle/tests/_output/
if-no-files-found: ignore
34 changes: 18 additions & 16 deletions .github/workflows/ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
env:
TEST_BUNDLE_NAME: "MembersBundle"
TEST_BUNDLE_INSTALLER_CLASS: "MembersBundle\\Tool\\Install"
TEST_BUNDLE_TEST_DIR: "${{ github.workspace }}/tests"
TEST_BUNDLE_TEST_DIR: "${{ github.workspace }}/lib/test-bundle/tests"
TEST_PROJECT_ROOT_DIR: "${{ github.workspace }}"

PIMCORE_CODECEPTION_FRAMEWORK: "${{ github.workspace }}/pimcore-codeception-framework"
PIMCORE_CODECEPTION_VERSION: "1.0"
PIMCORE_CODECEPTION_VERSION: "2.0"

PIMCORE_ENVIRONMENT: test
APP_ENV: test
PIMCORE_TEST_DB_DSN: "mysql://root:root@localhost/dachcom_bundle_test"
PIMCORE_TEST_URL: "http://localhost"

Expand All @@ -40,24 +40,28 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php: [7.4]
symfony: [^4.4]
pimcore: [^6.8]
php: [ 8.0 ]
symfony: [ ^5.3 ]
pimcore: [ ~10.2.0 ]
include:
- pimcore: ^6.8
template_tag: v2.8.0

- pimcore: ~10.2.0
template_tag: v10.1.4
steps:
- uses: actions/checkout@v2
with:
path: lib/test-bundle

- name: Generate Application Structure
run: |
git clone -b ${{ matrix.template_tag }} --single-branch --depth 1 https://github.com/pimcore/skeleton.git
mv skeleton/app .
mv skeleton/composer.json .
mv skeleton/bin .
mv skeleton/config .
mv skeleton/public .
mv skeleton/src .
mv skeleton/templates .
mv skeleton/var .
mv skeleton/web .
mv skeleton/src/AppBundle src
rm -r skeleton
- name: Setup Pimcore Codeception Framework
env:
Expand Down Expand Up @@ -91,8 +95,6 @@ jobs:
- name: Setup MySql
run: |
mysql -uroot -h127.0.0.1 -proot -e "SET GLOBAL innodb_file_format=Barracuda;"
mysql -uroot -h127.0.0.1 -proot -e "SET GLOBAL innodb_large_prefix=1;"
mysql -uroot -h127.0.0.1 -proot -e "CREATE DATABASE dachcom_bundle_test CHARSET=utf8mb4;"
- name: Get Composer Cache Directory
Expand All @@ -118,10 +120,10 @@ jobs:
- name: Assets Install
run: |
bin/console assets:install web --relative --symlink
bin/console assets:install public --relative --symlink
- name: Easy Coding Standard Check
continue-on-error: true
run: |
bin/console cache:warmup --env=test
vendor/bin/ecs check src/MembersBundle --config easy-coding-standard.yml
vendor/bin/ecs check ${{ github.workspace }}/lib/test-bundle/src/MembersBundle --config ${{ github.workspace }}/lib/test-bundle/ecs.php
33 changes: 18 additions & 15 deletions .github/workflows/php-stan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
env:
TEST_BUNDLE_NAME: "MembersBundle"
TEST_BUNDLE_INSTALLER_CLASS: "MembersBundle\\Tool\\Install"
TEST_BUNDLE_TEST_DIR: "${{ github.workspace }}/tests"
TEST_BUNDLE_TEST_DIR: "${{ github.workspace }}/lib/test-bundle/tests"
TEST_PROJECT_ROOT_DIR: "${{ github.workspace }}"

PIMCORE_CODECEPTION_FRAMEWORK: "${{ github.workspace }}/pimcore-codeception-framework"
PIMCORE_CODECEPTION_VERSION: "1.0"
PIMCORE_CODECEPTION_VERSION: "2.0"

PIMCORE_ENVIRONMENT: test
APP_ENV: test
PIMCORE_TEST_DB_DSN: "mysql://root:root@localhost/dachcom_bundle_test"
PIMCORE_TEST_URL: "http://localhost"

Expand All @@ -40,23 +40,28 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php: [7.4]
symfony: [^4.4]
pimcore: [^6.8]
php: [ 8.0 ]
symfony: [ ^5.3 ]
pimcore: [ ~10.2.0 ]
include:
- pimcore: ^6.8
template_tag: v2.8.0
- pimcore: ~10.2.0
template_tag: v10.1.4
steps:
- uses: actions/checkout@v2
with:
path: lib/test-bundle

- name: Generate Application Structure
run: |
git clone -b ${{ matrix.template_tag }} --single-branch --depth 1 https://github.com/pimcore/skeleton.git
mv skeleton/app .
mv skeleton/composer.json .
mv skeleton/bin .
mv skeleton/config .
mv skeleton/public .
mv skeleton/src .
mv skeleton/templates .
mv skeleton/var .
mv skeleton/web .
mv skeleton/src/AppBundle src
rm -r skeleton
- name: Setup Pimcore Codeception Framework
env:
Expand Down Expand Up @@ -90,8 +95,6 @@ jobs:
- name: Setup MySql
run: |
mysql -uroot -h127.0.0.1 -proot -e "SET GLOBAL innodb_file_format=Barracuda;"
mysql -uroot -h127.0.0.1 -proot -e "SET GLOBAL innodb_large_prefix=1;"
mysql -uroot -h127.0.0.1 -proot -e "CREATE DATABASE dachcom_bundle_test CHARSET=utf8mb4;"
- name: Get Composer Cache Directory
Expand All @@ -117,9 +120,9 @@ jobs:
- name: Assets Install
run: |
bin/console assets:install web --relative --symlink
bin/console assets:install public --relative --symlink
- name: Php Stan
run: |
bin/console cache:warmup --env=test
vendor/bin/phpstan analyse -c phpstan.neon -a tests/_phpstan-bootstrap.php src -l 2
vendor/bin/phpstan analyse -c${{ github.workspace }}/lib/test-bundle/phpstan.neon -a ${{ github.workspace }}/lib/test-bundle/tests/_phpstan-bootstrap.php ${{ github.workspace }}/lib/test-bundle/src -l 4
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# License
Copyright (C) 2018 DACHCOM.DIGITAL
Copyright (C) 2021 DACHCOM.DIGITAL

This software is available under the GNU General Public License version 3 (GPLv3).

Expand Down
2 changes: 1 addition & 1 deletion PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
| Q | A
| ------------- | ---
| Branch? | dev-master for features / 2.5 for bug fixes
| Branch? | master
| Bug fix? | yes/no
| New feature? | yes/no
| BC breaks? | no
Expand Down
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
# Pimcore Members
# Pimcore Members Bundle
Add frontend user authentication and document restriction to pimcore.

[![Join the chat at https://gitter.im/pimcore/pimcore](https://img.shields.io/gitter/room/pimcore/pimcore.svg?style=flat-square)](https://gitter.im/pimcore/pimcore)
[![Software License](https://img.shields.io/badge/license-GPLv3-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Latest Release](https://img.shields.io/packagist/v/dachcom-digital/members.svg?style=flat-square)](https://packagist.org/packages/dachcom-digital/members)
[![Tests](https://img.shields.io/github/workflow/status/dachcom-digital/pimcore-members/Codeception?style=flat-square&logo=github&label=codeception)](https://github.com/dachcom-digital/pimcore-members/actions?query=workflow%3A%22Codeception%22)
[![PhpStan](https://img.shields.io/github/workflow/status/dachcom-digital/pimcore-members/PHP%20Stan?style=flat-square&logo=github&label=phpstan%20level%202)](https://github.com/dachcom-digital/pimcore-members/actions?query=workflow%3A%22PHP%20Stan%22)
[![Tests](https://img.shields.io/github/workflow/status/dachcom-digital/pimcore-members/Codeception/master?style=flat-square&logo=github&label=codeception)](https://github.com/dachcom-digital/pimcore-members/actions?query=workflow%3ACodeception+branch%3Amaster)
[![PhpStan](https://img.shields.io/github/workflow/status/dachcom-digital/pimcore-members/PHP%20Stan/master?style=flat-square&logo=github&label=phpstan%20level%204)](https://github.com/dachcom-digital/pimcore-members/actions?query=workflow%3A"PHP+Stan"+branch%3Amaster)

### Release Plan

| Release | Supported Pimcore Versions | Supported Symfony Versions | Release Date | Maintained | Branch |
|---------|-----------------------------------|----------------------------|--------------|----------------|------------|
| **3.x** | `6.0` - `6.8` | `3.4`, `^4.4` | 21.07.2019 | Feature Branch | dev-master |
| **4.x** | `10.2` | `5.3` | 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 |
| **1.5** | `4.0` | -- | 07.07.2017 | Unsupported | pimcore4 |

## Features
* Create Members in Backend
* Create Members in backend
* Allow Members to register in frontend
* Restrict Documents, Objects and Assets to specific User Roles
* Restrict documents, objects and assets to specific user roles

***

Expand All @@ -30,52 +31,51 @@ Please read the installation instructions before going deep with Members!

```json
"require" : {
"dachcom-digital/members" : "~3.1.0"
"dachcom-digital/members" : "~4.0.0"
}
```

### Installation via Extension Manager
After you have installed the Members Bundle via composer, open pimcore backend and go to `Tools` => `Extension`:
- Click the green `+` Button in `Enable / Disable` row
- Click the green `+` Button in `Install/Uninstall` row

### Installation via CommandLine
After you have installed the Members Bundle via composer:
- Execute: `$ bin/console pimcore:bundle:enable MembersBundle`
- Execute: `$ bin/console pimcore:bundle:install MembersBundle`

#### Optional: Class Installation
## Upgrading
- Execute: `$ bin/console doctrine:migrations:migrate --prefix 'MembersBundle\Migrations'`

#### Optional: Class Installation
> Read more about the required classes [below](./README.md#class-installation)).
```bash
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 `MembersBundle/Resources/config/packages/security.yaml`
and merge your own firewall configuration into one single file.

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

**Include all Routes**
```yaml
# app/config/routing.yml
# config/routing.yaml
app:
resource: '@MembersBundle/Resources/config/pimcore/routing/all.yml'
```
**Just include some Routes**
```yaml
# app/config/routing.yml
# config/routing.yaml
members_auth:
resource: '@MembersBundle/Resources/config/pimcore/routing/auth.yml'
prefix: /{_locale}/members #change your prefix if you have to.
```
### Class Installation
Unlike members1, this bundle does not install any classes for you any more.
Since Members should be the one and only frontend authentication Bundle, we need to add the most flexibility as possible.
Since Members should be the one and only frontend authentication bundle, we need to add the most flexibility as possible.
But no worries, it's still simple to integrate.
> There is also a class installer command. If your not using any special class configuration, feel free to use this command: `$ bin/console members:install:class`
> There is also a class installer command. If you're not using any special class configuration, feel free to use this command: `$ bin/console members:install:class`
> Use the `-o` argument to also install the SsoIdentity Class

You need two classes: User and Group. So let's create it:
Expand Down Expand Up @@ -123,6 +123,7 @@ You're almost there, just check the [email configuration](docs/70_EmailConfigura
***

### User Management: Further Information
- [Auth Identifier](docs/10_AuthIdentifier.md) Use `email` instead of `username` for authentication
- [Custom Class Names](docs/20_ClassCustomization.md)
- [Frontend Routes & Views](docs/30_FrontendRoutes.md)
- [Available Events](docs/40_Events.md)
Expand All @@ -131,7 +132,6 @@ You're almost there, just check the [email configuration](docs/70_EmailConfigura
- [Email Configuration](docs/70_EmailConfiguration.md)
- [Groups](docs/80_Groups.md)
- [Roles](docs/90_Roles.md)
- [Use LuceneSearch with Members](docs/100_LuceneSearch.md)
- [Use the Pimcore Customer Framework with Members](docs/300_CustomerDataFw.md)

***
Expand Down
Loading

0 comments on commit db8040a

Please sign in to comment.