├── src
├── Accounts
│ ├── Delivery
│ │ ├── Console
│ │ │ └── .gitkeep
│ │ ├── Api
│ │ │ └── V1
│ │ │ │ └── Accounts
│ │ │ │ ├── Forms
│ │ │ │ ├── ChangeAccountNameRequest.php
│ │ │ │ ├── ViewAccountRequest.php
│ │ │ │ ├── CreateAccountRequest.php
│ │ │ │ └── SearchAccountsRequest.php
│ │ │ │ ├── Controllers
│ │ │ │ ├── DestroyController.php
│ │ │ │ ├── SearchController.php
│ │ │ │ ├── ViewController.php
│ │ │ │ ├── CreateController.php
│ │ │ │ ├── ChangeNameController.php
│ │ │ │ └── ActivationController.php
│ │ │ │ └── Transformers
│ │ │ │ └── AccountViewTransformer.php
│ │ └── ViewModels
│ │ │ └── AccountView.php
│ ├── Domain
│ │ ├── Queries
│ │ │ ├── FindAccounts.php
│ │ │ ├── GetAccountById.php
│ │ │ └── CountUsersOnAccount.php
│ │ ├── Events
│ │ │ ├── AccountCreated.php
│ │ │ ├── AccountActivated.php
│ │ │ ├── AccountDestroyed.php
│ │ │ ├── AccountDeactivated.php
│ │ │ └── AccountNameUpdated.php
│ │ ├── Commands
│ │ │ ├── ActivateAccount.php
│ │ │ ├── DestroyAccount.php
│ │ │ ├── DeactivateAccount.php
│ │ │ ├── CreateAccount.php
│ │ │ └── ChangeAccountName.php
│ │ ├── Services
│ │ │ └── Repositories
│ │ │ │ └── AccountRepository.php
│ │ └── Models
│ │ │ └── Account.php
│ ├── Application
│ │ ├── QueryHandlers
│ │ │ ├── CountUsersOnAccountQueryHandler.php
│ │ │ ├── GetAccountByIdQueryHandler.php
│ │ │ └── FindAccountsQueryHandler.php
│ │ └── CommandHandlers
│ │ │ ├── ActivateAccountCommandHandler.php
│ │ │ ├── DeactivateAccountCommandHandler.php
│ │ │ ├── ChangeAccountNameCommandHandler.php
│ │ │ ├── CreateAccountCommandHandler.php
│ │ │ └── DestroyAccountCommandHandler.php
│ └── Infrastructure
│ │ └── Persistence
│ │ ├── EntityLocators
│ │ └── AccountLocator.php
│ │ └── Repositories
│ │ └── AccountRepository.php
├── Users
│ ├── Delivery
│ │ ├── Console
│ │ │ └── .gitkeep
│ │ ├── Api
│ │ │ └── V1
│ │ │ │ ├── Users
│ │ │ │ ├── Forms
│ │ │ │ │ ├── UpdateEmailRequest.php
│ │ │ │ │ ├── ChangeNameRequest.php
│ │ │ │ │ ├── UpdateAccountRequest.php
│ │ │ │ │ ├── ResetPasswordRequest.php
│ │ │ │ │ ├── ChangeAuthCredentialsRequest.php
│ │ │ │ │ ├── ViewUserRequest.php
│ │ │ │ │ ├── CreateUserRequest.php
│ │ │ │ │ └── SearchUsersRequest.php
│ │ │ │ ├── Controllers
│ │ │ │ │ ├── DestroyController.php
│ │ │ │ │ ├── SearchController.php
│ │ │ │ │ ├── ViewController.php
│ │ │ │ │ ├── ChangeNameController.php
│ │ │ │ │ ├── ChangeAccountController.php
│ │ │ │ │ ├── ActivationController.php
│ │ │ │ │ ├── ChangeAuthCredentialsController.php
│ │ │ │ │ └── CreateController.php
│ │ │ │ └── Transformers
│ │ │ │ │ └── UserViewTransformer.php
│ │ │ │ ├── Permissions
│ │ │ │ ├── Forms
│ │ │ │ │ ├── CreatePermissionRequest.php
│ │ │ │ │ └── SearchPermissionsRequest.php
│ │ │ │ ├── Transformers
│ │ │ │ │ └── PermissionViewTransformer.php
│ │ │ │ └── Controllers
│ │ │ │ │ ├── DestroyController.php
│ │ │ │ │ ├── CreateController.php
│ │ │ │ │ └── SearchController.php
│ │ │ │ └── Roles
│ │ │ │ ├── Forms
│ │ │ │ ├── ChangeGrantableRolesRequest.php
│ │ │ │ ├── ChangePermissionsRequest.php
│ │ │ │ ├── ViewRoleRequest.php
│ │ │ │ ├── CreateRoleRequest.php
│ │ │ │ └── SearchRolesRequest.php
│ │ │ │ ├── Controllers
│ │ │ │ ├── DestroyController.php
│ │ │ │ ├── SearchController.php
│ │ │ │ ├── ViewController.php
│ │ │ │ ├── ChangeRolesController.php
│ │ │ │ ├── ChangePermissionsController.php
│ │ │ │ └── CreateController.php
│ │ │ │ └── Transformers
│ │ │ │ └── RoleViewTransformer.php
│ │ └── ViewModels
│ │ │ ├── PermissionView.php
│ │ │ └── RoleView.php
│ ├── Domain
│ │ ├── Models
│ │ │ ├── AccountId.php
│ │ │ ├── UserName.php
│ │ │ ├── PermissionName.php
│ │ │ ├── Permission.php
│ │ │ ├── RoleName.php
│ │ │ ├── User
│ │ │ │ ├── UserRoles.php
│ │ │ │ └── UserPermissions.php
│ │ │ ├── Role.php
│ │ │ └── Role
│ │ │ │ └── RoleGrantableRoles.php
│ │ ├── Queries
│ │ │ ├── FindRoles.php
│ │ │ ├── FindUsers.php
│ │ │ ├── GetAccountById.php
│ │ │ ├── FindPermissions.php
│ │ │ ├── GetRoleById.php
│ │ │ ├── GetUserById.php
│ │ │ ├── GetPermissionByName.php
│ │ │ └── DoesUserExistWithEmail.php
│ │ ├── Events
│ │ │ ├── UserCreated.php
│ │ │ ├── UserActivated.php
│ │ │ ├── UserDestroyed.php
│ │ │ ├── UserDeactivated.php
│ │ │ ├── UserNameChanged.php
│ │ │ ├── GrantedRolesToUser.php
│ │ │ ├── UserAccountChanged.php
│ │ │ ├── RevokedRolesFromUser.php
│ │ │ ├── GrantedPermissionsToRole.php
│ │ │ ├── GrantedPermissionsToUser.php
│ │ │ ├── RevokedPermissionsFromRole.php
│ │ │ ├── RevokedPermissionsFromUser.php
│ │ │ ├── AllRolesHaveBeenRevokedFromRole.php
│ │ │ ├── RoleHasBeenAllowedToGrantRoles.php
│ │ │ ├── RoleHasBeenDeniedGrantingRoles.php
│ │ │ ├── AllPermissionsHaveBeenRevokedFromRole.php
│ │ │ └── UserAuthenticationCredentialsChanged.php
│ │ ├── Commands
│ │ │ ├── DestroyPermission.php
│ │ │ ├── ActivateUser.php
│ │ │ ├── DestroyRole.php
│ │ │ ├── DestroyUser.php
│ │ │ ├── DeactivateUser.php
│ │ │ ├── CreatePermission.php
│ │ │ ├── ChangeUsersName.php
│ │ │ ├── ChangeUsersAccount.php
│ │ │ ├── ChangeGrantableRoles.php
│ │ │ ├── ChangeRolePermissions.php
│ │ │ ├── ChangeUsersAuthCredentials.php
│ │ │ ├── CreateRole.php
│ │ │ └── CreateUser.php
│ │ └── Services
│ │ │ └── Repositories
│ │ │ ├── UserRepository.php
│ │ │ ├── RoleRepository.php
│ │ │ └── PermissionRepository.php
│ ├── Infrastructure
│ │ └── Persistence
│ │ │ ├── Types
│ │ │ ├── RoleNameType.php
│ │ │ ├── UserNameType.php
│ │ │ ├── PermissionNameType.php
│ │ │ └── AbstractNameType.php
│ │ │ ├── EntityLocators
│ │ │ ├── RoleLocator.php
│ │ │ ├── PermissionLocator.php
│ │ │ └── UserLocator.php
│ │ │ └── Repositories
│ │ │ ├── UserRepository.php
│ │ │ ├── RoleRepository.php
│ │ │ └── PermissionRepository.php
│ └── Application
│ │ ├── QueryHandlers
│ │ ├── FindPermissionsQueryHandler.php
│ │ ├── GetAccountByIdQueryHandler.php
│ │ ├── FindRolesQueryHandler.php
│ │ ├── DoesUserExistWithEmailQueryHandler.php
│ │ ├── GetPermissionByNameQueryHandler.php
│ │ ├── GetRoleByIdQueryHandler.php
│ │ ├── GetUserByIdQueryHandler.php
│ │ └── FindUsersQueryHandler.php
│ │ └── CommandHandlers
│ │ ├── DestroyRoleCommandHandler.php
│ │ ├── DestroyUserCommandHandler.php
│ │ ├── ActivateUserCommandHandler.php
│ │ ├── CreatePermissionCommandHandler.php
│ │ ├── DeactivateUserCommandHandler.php
│ │ ├── DestroyPermissionCommandHandler.php
│ │ ├── ChangeUsersNameCommandHandler.php
│ │ ├── ChangeGrantableRolesCommandHandler.php
│ │ ├── ChangeUsersAccountCommandHandler.php
│ │ ├── ChangeRolePermissionsCommandHandler.php
│ │ ├── ChangeUsersAuthCredentialsCommandHandler.php
│ │ ├── CreateRoleCommandHandler.php
│ │ └── CreateUserCommandHandler.php
└── Resources
│ ├── Delivery
│ ├── Api
│ │ ├── ApiController.php
│ │ └── IndexController.php
│ └── Console
│ │ └── AbstractCommand.php
│ ├── Application
│ └── QueryHandlers
│ │ └── Behaviours
│ │ └── CanApplyOrderToQuery.php
│ └── ResourcesBundle.php
├── config
├── docker
│ ├── test
│ │ ├── db-accounts
│ │ │ └── init.sql
│ │ └── app
│ │ │ ├── conf.d
│ │ │ └── zz-custom.ini
│ │ │ ├── docker-entrypoint.sh
│ │ │ └── Dockerfile
│ ├── dev
│ │ └── app
│ │ │ ├── conf.d
│ │ │ └── zz-custom.ini
│ │ │ ├── docker-entrypoint.sh
│ │ │ └── Dockerfile
│ └── prod
│ │ └── app
│ │ ├── conf.d
│ │ └── zz-custom.ini
│ │ ├── docker-entrypoint.sh
│ │ └── Dockerfile
├── packages
│ ├── validator.yaml
│ ├── liip.yaml
│ ├── routing.yaml
│ ├── twig.yaml
│ ├── debug.yaml
│ ├── dama_doctrine_test_bundle.yaml
│ ├── doctrine_migrations.yaml
│ ├── framework.yaml
│ ├── web_profiler.yaml
│ ├── cache.yaml
│ ├── somnambulist_services.yaml
│ ├── messenger.yaml
│ ├── doctrine.yaml
│ └── somnambulist.yaml
├── routes
│ ├── dev
│ │ ├── framework.yaml
│ │ └── web_profiler.yaml
│ └── api
│ │ ├── v1.yaml
│ │ └── v1
│ │ └── permissions.yaml
├── openapi
│ └── schemas
│ │ ├── Permission.yaml
│ │ ├── ServiceList.yaml
│ │ ├── RoleSearchResult.yaml
│ │ ├── AccountSearchResult.yaml
│ │ ├── UserSearchResult.yaml
│ │ ├── PermissionSearchResult.yaml
│ │ ├── Account.yaml
│ │ ├── Pagination.yaml
│ │ ├── Role.yaml
│ │ ├── Error.yaml
│ │ └── User.yaml
├── mappings
│ ├── users
│ │ ├── AccountId.orm.xml
│ │ └── Permission.orm.xml
│ ├── somnambulist
│ │ └── Identity.ExternalIdentity.orm.xml
│ └── accounts
│ │ └── Account.orm.xml
├── routes.yaml
└── bundles.php
├── .env.test
├── public
├── favicon.ico
└── index.php
├── .dockerignore
├── .idea
├── vcs.xml
├── .gitignore
├── vagrant.xml
├── phpunit.xml
├── symfony2.xml
├── modules.xml
├── php-test-framework.xml
├── misc.xml
└── webResources.xml
├── bin
├── dc-shell
├── dc-composer
├── dc-console
├── dc-phpunit
└── console
├── docker-compose-release.yml
├── templates
└── base.html.twig
├── tests
├── Support
│ ├── Factories
│ │ └── AccountFactory.php
│ ├── Behaviours
│ │ ├── FixturesTrait.php
│ │ ├── BootKernel.php
│ │ ├── UseObjectFactoryHelper.php
│ │ ├── DoctrineHelper.php
│ │ ├── GenerateRouteTo.php
│ │ └── BootTestClient.php
│ └── Fixtures
│ │ ├── AccountFixture.php
│ │ ├── RoleFixture.php
│ │ ├── AccountWithUserFixture.php
│ │ └── RoleWithPermissionFixture.php
├── bootstrap.php
├── Users
│ ├── Domain
│ │ └── Models
│ │ │ └── PermissionTest.php
│ └── Delivery
│ │ └── Api
│ │ └── V1
│ │ ├── Permissions
│ │ ├── DestroyPermissionsTest.php
│ │ ├── CreatePermissionsTest.php
│ │ └── ListPermissionsTest.php
│ │ ├── Roles
│ │ ├── ListRolesTest.php
│ │ ├── ViewRoleTest.php
│ │ └── DestroyRoleTest.php
│ │ └── Users
│ │ ├── DestroyUserTest.php
│ │ ├── ViewUserTest.php
│ │ ├── ListUserTest.php
│ │ ├── ChangeNameTest.php
│ │ └── UpdateAccountTest.php
├── DocumentationTest.php
└── Accounts
│ └── Delivery
│ └── Api
│ └── V1
│ └── Accounts
│ ├── CreateAccountTest.php
│ ├── ViewAccountTest.php
│ ├── DestroyAccountTest.php
│ └── ChangeAccountNameTest.php
├── ppm.dist.json
├── docker-compose.yml
├── docker-compose-test.yml
├── phpunit.xml.dist
└── migrations
└── Version20201003220231.php
/src/Accounts/Delivery/Console/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/Users/Delivery/Console/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/config/docker/test/db-accounts/init.sql:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.env.test:
--------------------------------------------------------------------------------
1 | # define your env variables for the test env here
2 | APP_SECRET='$ecretf0rt3st'
3 |
--------------------------------------------------------------------------------
/config/packages/validator.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | validation:
3 | email_validation_mode: html5
4 |
--------------------------------------------------------------------------------
/config/packages/liip.yaml:
--------------------------------------------------------------------------------
1 | when@dev,test:
2 | liip_test_fixtures:
3 | keep_database_and_schema: true
4 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/somnambulist-tech/accounts-service-skeleton/HEAD/public/favicon.ico
--------------------------------------------------------------------------------
/config/packages/routing.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | router:
3 | strict_requirements: null
4 | utf8: true
5 |
--------------------------------------------------------------------------------
/config/routes/dev/framework.yaml:
--------------------------------------------------------------------------------
1 | _errors:
2 | resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
3 | prefix: /_error
4 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | .idea
2 | *.md
3 | .git
4 | .dockerignore
5 | vendor
6 | supervisord.*
7 | bin/dc-*
8 | bin/*.sh
9 | var
10 | docker-compose*
11 | .env.local
12 | .env.*.local
13 |
--------------------------------------------------------------------------------
/config/openapi/schemas/Permission.yaml:
--------------------------------------------------------------------------------
1 | type: object
2 | properties:
3 | id:
4 | type: string
5 |
6 | created_at:
7 | type: string
8 | format: date-time
9 |
--------------------------------------------------------------------------------
/config/packages/twig.yaml:
--------------------------------------------------------------------------------
1 | twig:
2 | default_path: '%kernel.project_dir%/templates'
3 | debug: '%kernel.debug%'
4 |
5 | when@test:
6 | twig:
7 | strict_variables: true
8 |
--------------------------------------------------------------------------------
/config/packages/debug.yaml:
--------------------------------------------------------------------------------
1 | when@dev:
2 | debug:
3 | dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%"
4 |
5 | when@test:
6 | debug:
7 | dump_destination: "php://stderr"
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Datasource local storage ignored files
5 | /dataSources/
6 | /dataSources.local.xml
7 | # Editor-based HTTP Client requests
8 | /httpRequests/
9 |
--------------------------------------------------------------------------------
/config/openapi/schemas/ServiceList.yaml:
--------------------------------------------------------------------------------
1 | type: object
2 | description: "The list of valid end points for this service."
3 | properties:
4 | services:
5 | type: array
6 | items:
7 | type: string
8 |
--------------------------------------------------------------------------------
/config/packages/dama_doctrine_test_bundle.yaml:
--------------------------------------------------------------------------------
1 | when@test:
2 | dama_doctrine_test:
3 | enable_static_connection: true
4 | enable_static_meta_data_cache: true
5 | enable_static_query_cache: true
6 |
--------------------------------------------------------------------------------
/bin/dc-shell:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | DIR="${BASH_SOURCE%/*}"; if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi;
4 | if [[ -f "${DIR}/../.env" ]]; then . "${DIR}/../.env"; fi;
5 |
6 | docker-compose exec ${APP_SERVICE_APP} bash
7 |
--------------------------------------------------------------------------------
/bin/dc-composer:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | DIR="${BASH_SOURCE%/*}"; if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi;
4 | if [[ -f "${DIR}/../.env" ]]; then . "${DIR}/../.env"; fi;
5 |
6 | docker-compose exec ${APP_SERVICE_APP} /usr/bin/composer "$@"
7 |
--------------------------------------------------------------------------------
/.idea/vagrant.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/bin/dc-console:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | DIR="${BASH_SOURCE%/*}"; if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi;
4 | if [[ -f "${DIR}/../.env" ]]; then . "${DIR}/../.env"; fi;
5 |
6 | docker-compose exec ${APP_SERVICE_APP} ${APP_PATH}/bin/console "$@"
7 |
--------------------------------------------------------------------------------
/bin/dc-phpunit:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | DIR="${BASH_SOURCE%/*}"; if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi;
4 | if [[ -f "${DIR}/../.env" ]]; then . "${DIR}/../.env"; fi;
5 |
6 | docker-compose exec -T ${APP_SERVICE_APP} ${APP_PATH}/bin/phpunit "$@"
7 |
--------------------------------------------------------------------------------
/src/Users/Domain/Models/AccountId.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
--------------------------------------------------------------------------------
/src/Users/Domain/Events/UserActivated.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/config/openapi/schemas/PermissionSearchResult.yaml:
--------------------------------------------------------------------------------
1 | type: object
2 | properties:
3 | data:
4 | type: array
5 | items: { $ref: '#/components/schemas/Permission' }
6 | meta:
7 | type: object
8 | properties:
9 | pagination: { $ref: '#/components/schemas/Pagination' }
10 |
--------------------------------------------------------------------------------
/src/Users/Domain/Events/AllRolesHaveBeenRevokedFromRole.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {% block title %}Welcome!{% endblock %}
6 | {% block stylesheets %}{% endblock %}
7 |
8 |
9 | {% block body %}{% endblock %}
10 | {% block javascripts %}{% endblock %}
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/Accounts/Domain/Queries/GetAccountById.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/Users/Domain/Commands/ChangeUsersName.php:
--------------------------------------------------------------------------------
1 | 'required|email',
13 | ];
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/Users/Delivery/Api/V1/Users/Forms/ChangeNameRequest.php:
--------------------------------------------------------------------------------
1 | 'required|min:1|max:255',
13 | ];
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Users/Delivery/Api/V1/Users/Forms/UpdateAccountRequest.php:
--------------------------------------------------------------------------------
1 | 'required|uuid',
13 | ];
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Users/Domain/Commands/ChangeUsersAccount.php:
--------------------------------------------------------------------------------
1 | 'required|max:255'
13 | ];
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Users/Domain/Commands/ChangeGrantableRoles.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/Users/Delivery/Api/V1/Users/Forms/ResetPasswordRequest.php:
--------------------------------------------------------------------------------
1 | 'required|min:1|max:255',
13 | ];
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Users/Domain/Commands/ChangeRolePermissions.php:
--------------------------------------------------------------------------------
1 | get(DatabaseToolCollection::class)->get()->loadFixtures($classNames, $append);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Accounts/Domain/Commands/CreateAccount.php:
--------------------------------------------------------------------------------
1 | 'required|min:1|max:255',
13 | ];
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Accounts/Domain/Commands/ChangeAccountName.php:
--------------------------------------------------------------------------------
1 | bootEnv(dirname(__DIR__).'/.env');
11 | }
12 |
13 | if (!defined('AMQP_NOPARAM')) {
14 | define('AMQP_NOPARAM', 0);
15 | }
16 |
--------------------------------------------------------------------------------
/src/Resources/Delivery/Api/IndexController.php:
--------------------------------------------------------------------------------
1 | [
13 | 'accounts', 'permissions', 'roles', 'users',
14 | ]
15 | ]);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Users/Delivery/Api/V1/Roles/Forms/ChangeGrantableRolesRequest.php:
--------------------------------------------------------------------------------
1 | 'required|array',
13 | 'roles.*' => 'min:1|max:255',
14 | ];
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Users/Delivery/Api/V1/Permissions/Transformers/PermissionViewTransformer.php:
--------------------------------------------------------------------------------
1 | toArray();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Users/Delivery/Api/V1/Roles/Forms/ChangePermissionsRequest.php:
--------------------------------------------------------------------------------
1 | 'required|array',
13 | 'permissions.*' => 'min:1|max:255',
14 | ];
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/config/docker/dev/app/conf.d/zz-custom.ini:
--------------------------------------------------------------------------------
1 | date.timezone = UTC
2 | default_charset = utf-8
3 | memory_limit = 64M
4 | max_execution_time = 60
5 | realpath_cache_size = 4096K
6 | realpath_cache_ttl = 600
7 |
8 | apc.shm_size = 128M
9 | apc.entries_hint = 0
10 | apc.enable_cli = 1
11 |
12 | opcache.interned_strings_buffer = 8
13 | opcache.max_accelerated_files = 36000
14 | opcache.memory_consumption = 128
15 | opcache.revalidate_freq = 0
16 | opcache.validate_timestamps = 0
17 | opcache.fast_shutdown = 1
18 |
--------------------------------------------------------------------------------
/config/docker/prod/app/conf.d/zz-custom.ini:
--------------------------------------------------------------------------------
1 | date.timezone = UTC
2 | default_charset = utf-8
3 | memory_limit = 64M
4 | max_execution_time = 60
5 | realpath_cache_size = 4096K
6 | realpath_cache_ttl = 600
7 |
8 | apc.shm_size = 128M
9 | apc.entries_hint = 0
10 | apc.enable_cli = 1
11 |
12 | opcache.interned_strings_buffer = 8
13 | opcache.max_accelerated_files = 36000
14 | opcache.memory_consumption = 128
15 | opcache.revalidate_freq = 0
16 | opcache.validate_timestamps = 0
17 | opcache.fast_shutdown = 1
18 |
--------------------------------------------------------------------------------
/config/docker/test/app/conf.d/zz-custom.ini:
--------------------------------------------------------------------------------
1 | date.timezone = UTC
2 | default_charset = utf-8
3 | memory_limit = 64M
4 | max_execution_time = 60
5 | realpath_cache_size = 4096K
6 | realpath_cache_ttl = 600
7 |
8 | apc.shm_size = 128M
9 | apc.entries_hint = 0
10 | apc.enable_cli = 1
11 |
12 | opcache.interned_strings_buffer = 8
13 | opcache.max_accelerated_files = 36000
14 | opcache.memory_consumption = 128
15 | opcache.revalidate_freq = 0
16 | opcache.validate_timestamps = 0
17 | opcache.fast_shutdown = 1
18 |
--------------------------------------------------------------------------------
/src/Accounts/Application/QueryHandlers/CountUsersOnAccountQueryHandler.php:
--------------------------------------------------------------------------------
1 | whereColumn('account_id', '=', $query->id)->count();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Users/Delivery/Api/V1/Users/Forms/ChangeAuthCredentialsRequest.php:
--------------------------------------------------------------------------------
1 | 'required|email|min:3|max:60',
13 | 'password' => 'required|min:1|max:255',
14 | ];
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Users/Domain/Commands/ChangeUsersAuthCredentials.php:
--------------------------------------------------------------------------------
1 | [
13 | 'sometimes',
14 | 'regex:/(users(.roles)?(.permissions)?)|(roles(.permissions)?)/',
15 | ],
16 | ];
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Users/Delivery/Api/V1/Users/Forms/ViewUserRequest.php:
--------------------------------------------------------------------------------
1 | [
13 | 'sometimes',
14 | 'regex:/(users(.roles)?(.permissions)?)|(roles(.permissions)?)/',
15 | ],
16 | ];
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/config/mappings/users/AccountId.orm.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/config/packages/cache.yaml:
--------------------------------------------------------------------------------
1 | framework:
2 | cache:
3 | app: cache.adapter.redis
4 | system: cache.adapter.redis
5 | default_redis_provider: '%env(REDIS_URL)%'
6 | pools:
7 | doctrine.query_cache_pool:
8 | adapter: cache.adapter.apcu
9 | doctrine.result_cache_pool:
10 | adapter: cache.app
11 |
12 | cache.app.accounts_service:
13 | adapter: cache.app
14 | public: true
15 | default_lifetime: 3600
16 |
--------------------------------------------------------------------------------
/src/Users/Application/QueryHandlers/FindPermissionsQueryHandler.php:
--------------------------------------------------------------------------------
1 | orderBy('name')->paginate($query->page(), $query->perPage());
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/config/openapi/schemas/Account.yaml:
--------------------------------------------------------------------------------
1 | type: object
2 | properties:
3 | id:
4 | type: string
5 | format: uuid
6 |
7 | name:
8 | type: string
9 |
10 | created_at:
11 | type: string
12 | format: date-time
13 |
14 | updated_at:
15 | type: string
16 | format: date-time
17 |
18 | users:
19 | type: array
20 | description: The users assigned to this account if included in the results.
21 | items:
22 | $ref: "#/components/schemas/User"
23 |
--------------------------------------------------------------------------------
/src/Accounts/Delivery/Api/V1/Accounts/Forms/ViewAccountRequest.php:
--------------------------------------------------------------------------------
1 | [
13 | 'sometimes',
14 | 'regex:/(users(.roles)?(.permissions)?)|(roles(.permissions)?)/',
15 | ],
16 | ];
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/config/routes.yaml:
--------------------------------------------------------------------------------
1 | api.docs:
2 | resource: '@SomnambulistApiBundle/Resources/config/routes.xml'
3 |
4 | api.index:
5 | path: /
6 | controller: App\Resources\Delivery\Api\IndexController
7 | methods: [ GET ]
8 | defaults:
9 | document: true
10 | operation: 'getListOfServices'
11 | responses:
12 | 200: 'schemas/ServiceList'
13 |
14 | api.v1:
15 | resource: 'routes/api/v1.yaml'
16 | prefix: /v1
17 | trailing_slash_on_root: false
18 | name_prefix: 'api.v1.'
19 | defaults:
20 | document: true
21 |
--------------------------------------------------------------------------------
/tests/Support/Behaviours/BootKernel.php:
--------------------------------------------------------------------------------
1 | setUpTests();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Users/Domain/Models/UserName.php:
--------------------------------------------------------------------------------
1 | notEmpty()->notBlank()->notNull()->minLength(3)->maxLength(100);
13 | }
14 |
15 | public function toString(): string
16 | {
17 | return $this->value;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Users/Domain/Commands/CreateRole.php:
--------------------------------------------------------------------------------
1 | factory()->account->account();
16 | $manager->persist($account);
17 |
18 | $manager->flush();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/bin/console:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | command()->dispatch(new DestroyPermission($id));
14 |
15 | return $this->deleted($id);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tests/Users/Domain/Models/PermissionTest.php:
--------------------------------------------------------------------------------
1 | assertEquals('permission', $ent->name());
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Users/Application/CommandHandlers/DestroyRoleCommandHandler.php:
--------------------------------------------------------------------------------
1 | roles->find($command->id);
17 | $role->destroy();
18 |
19 | $this->roles->destroy($role);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/config/mappings/somnambulist/Identity.ExternalIdentity.orm.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/Users/Delivery/Api/V1/Roles/Controllers/DestroyController.php:
--------------------------------------------------------------------------------
1 | command()->dispatch(new DestroyRole($id));
15 |
16 | return $this->deleted($id);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Users/Delivery/Api/V1/Users/Controllers/DestroyController.php:
--------------------------------------------------------------------------------
1 | command()->dispatch(new DestroyUser($id));
15 |
16 | return $this->deleted($id);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/Support/Behaviours/UseObjectFactoryHelper.php:
--------------------------------------------------------------------------------
1 | factory instanceof ObjectFactoryHelper) {
16 | $this->factory = new ObjectFactoryHelper($locale);
17 | }
18 |
19 | return $this->factory;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tests/Support/Behaviours/DoctrineHelper.php:
--------------------------------------------------------------------------------
1 | get('doctrine')->getManager();
13 | }
14 |
15 | protected function locatorFor(string $class): AbstractEntityLocator
16 | {
17 | return static::getContainer()->get('doctrine')->getManager()->getRepository($class);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Users/Application/CommandHandlers/DestroyUserCommandHandler.php:
--------------------------------------------------------------------------------
1 | repository->find($command->id);
17 | $user->destroy();
18 |
19 | $this->repository->destroy($user);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Users/Application/CommandHandlers/ActivateUserCommandHandler.php:
--------------------------------------------------------------------------------
1 | repository->find($command->id);
17 | $user->activate();
18 |
19 | $this->repository->store($user);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Users/Application/CommandHandlers/CreatePermissionCommandHandler.php:
--------------------------------------------------------------------------------
1 | permissions->store(new Permission($command->name));
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Accounts/Delivery/Api/V1/Accounts/Controllers/DestroyController.php:
--------------------------------------------------------------------------------
1 | command()->dispatch(new DestroyAccount($id));
15 |
16 | return $this->deleted($id);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Users/Application/CommandHandlers/DeactivateUserCommandHandler.php:
--------------------------------------------------------------------------------
1 | repository->find($command->id);
17 | $user->deactivate();
18 |
19 | $this->repository->store($user);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Users/Delivery/Api/V1/Roles/Forms/CreateRoleRequest.php:
--------------------------------------------------------------------------------
1 | 'required|min:1|max:255',
13 | 'roles' => 'sometimes|array',
14 | 'roles.*' => 'min:1|max:255',
15 | 'permissions' => 'sometimes|array',
16 | 'permissions.*' => 'min:1|max:255',
17 | ];
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Users/Domain/Services/Repositories/UserRepository.php:
--------------------------------------------------------------------------------
1 | permissions->findByName($command->name);
17 |
18 | $this->permissions->destroy($perm);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Users/Domain/Models/PermissionName.php:
--------------------------------------------------------------------------------
1 | notEmpty()
14 | ->notBlank()
15 | ->notNull()
16 | ->maxLength(255)
17 | ;
18 | }
19 |
20 | public function toString(): string
21 | {
22 | return $this->value;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Accounts/Application/CommandHandlers/ActivateAccountCommandHandler.php:
--------------------------------------------------------------------------------
1 | repository->find($command->id);
17 | $account->activate();
18 |
19 | $this->repository->store($account);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Accounts/Application/CommandHandlers/DeactivateAccountCommandHandler.php:
--------------------------------------------------------------------------------
1 | repository->find($command->id);
17 | $account->deactivate();
18 |
19 | $this->repository->store($account);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tests/Support/Fixtures/RoleFixture.php:
--------------------------------------------------------------------------------
1 | factory()->user->role($role);
17 | $manager->persist($entity);
18 | }
19 |
20 | $manager->flush();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Accounts/Domain/Services/Repositories/AccountRepository.php:
--------------------------------------------------------------------------------
1 | name = $name;
16 | $this->createdAt = DateTime::now();
17 | }
18 |
19 | public function id(): ?int
20 | {
21 | return $this->id;
22 | }
23 |
24 | public function name(): PermissionName
25 | {
26 | return $this->name;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Accounts/Application/CommandHandlers/ChangeAccountNameCommandHandler.php:
--------------------------------------------------------------------------------
1 | repository->find($command->id);
17 | $account->changeName($command->name);
18 |
19 | $this->repository->store($account);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Users/Domain/Commands/CreateUser.php:
--------------------------------------------------------------------------------
1 | repository->find($command->id);
18 | $user->changeName(new UserName($command->name));
19 |
20 | $this->repository->store($user);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Users/Domain/Models/RoleName.php:
--------------------------------------------------------------------------------
1 | notEmpty()
14 | ->notBlank()
15 | ->notNull()
16 | ->minLength(3)
17 | ->maxLength(50)
18 | ->regex('/[a-z0-9_]/')
19 | ;
20 | }
21 |
22 | public function toString(): string
23 | {
24 | return $this->value;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tests/Support/Behaviours/GenerateRouteTo.php:
--------------------------------------------------------------------------------
1 | get('router')->getGenerator()->generate($name, $parameters);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Accounts/Application/CommandHandlers/CreateAccountCommandHandler.php:
--------------------------------------------------------------------------------
1 | id,
19 | $command->name,
20 | );
21 |
22 | $this->accounts->store($account);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/config/openapi/schemas/Role.yaml:
--------------------------------------------------------------------------------
1 | type: object
2 | properties:
3 | id:
4 | type: string
5 | format: uuid
6 |
7 | name:
8 | type: string
9 |
10 | created_at:
11 | type: string
12 | format: date-time
13 |
14 | updated_at:
15 | type: string
16 | format: date-time
17 |
18 | permissions:
19 | type: array
20 | description: The set of permissions granted to this role.
21 | items:
22 | $ref: "#/components/schemas/Permission"
23 |
24 | roles:
25 | type: array
26 | description: The list of roles that this role may grant to another User.
27 | items:
28 | $ref: "#/components/schemas/Role"
29 |
--------------------------------------------------------------------------------
/tests/Support/Behaviours/BootTestClient.php:
--------------------------------------------------------------------------------
1 | __kernelBrowserClient = self::createClient();
25 |
26 | if (method_exists($this, 'setUpTests')) {
27 | $this->setUpTests();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Users/Application/CommandHandlers/ChangeGrantableRolesCommandHandler.php:
--------------------------------------------------------------------------------
1 | roles->find($command->id);
17 | $role->roles()->revokeAll();
18 |
19 | foreach ($command->roles as $roleId) {
20 | $role->roles()->grant($this->roles->find($roleId));
21 | }
22 |
23 | $this->roles->store($role);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Accounts/Delivery/Api/V1/Accounts/Forms/CreateAccountRequest.php:
--------------------------------------------------------------------------------
1 | 'required|uuid',
15 | 'name' => 'required|max:255',
16 | ];
17 | }
18 |
19 | public function command(): CreateAccount
20 | {
21 | return new CreateAccount(
22 | new Uuid($this->data()->get('id')),
23 | $this->data()->get('name'),
24 | );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Users/Delivery/Api/V1/Users/Forms/CreateUserRequest.php:
--------------------------------------------------------------------------------
1 | 'required|uuid',
13 | 'email' => 'required|email|min:3|max:60',
14 | 'password' => 'required|min:1|max:255',
15 | 'name' => 'required|min:1|max:255',
16 | 'roles' => 'sometimes|array',
17 | 'roles.*' => 'min:1|max:255',
18 | 'permissions' => 'sometimes|array',
19 | 'permissions.*' => 'min:1|max:255',
20 | ];
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Accounts/Delivery/Api/V1/Accounts/Transformers/AccountViewTransformer.php:
--------------------------------------------------------------------------------
1 | toArray();
17 | }
18 |
19 | public function includeUsers(AccountView $account): Collection
20 | {
21 | return $this->collection($account->users, UserViewTransformer::class);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/config/routes/api/v1.yaml:
--------------------------------------------------------------------------------
1 | accounts:
2 | resource: 'v1/accounts.yaml'
3 | prefix: /accounts
4 | trailing_slash_on_root: false
5 | name_prefix: 'accounts.'
6 | defaults:
7 | tags: [ 'v1', 'accounts' ]
8 |
9 | permissions:
10 | resource: 'v1/permissions.yaml'
11 | prefix: /permissions
12 | trailing_slash_on_root: false
13 | name_prefix: 'permissions.'
14 | defaults:
15 | tags: [ 'v1', 'permissions' ]
16 |
17 | roles:
18 | resource: 'v1/roles.yaml'
19 | prefix: /roles
20 | trailing_slash_on_root: false
21 | name_prefix: 'roles.'
22 | defaults:
23 | tags: [ 'v1', 'roles' ]
24 |
25 | users:
26 | resource: 'v1/users.yaml'
27 | prefix: /users
28 | trailing_slash_on_root: false
29 | name_prefix: 'users.'
30 | defaults:
31 | tags: [ 'v1', 'users' ]
32 |
--------------------------------------------------------------------------------
/src/Users/Application/QueryHandlers/GetAccountByIdQueryHandler.php:
--------------------------------------------------------------------------------
1 | id());
17 | } catch (ReadModelNotFound) {
18 | throw EntityNotFoundException::entityNotFound(Account::class, (string)$query->id());
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Users/Domain/Services/Repositories/RoleRepository.php:
--------------------------------------------------------------------------------
1 | id());
17 | } catch (ReadModelNotFound) {
18 | throw EntityNotFoundException::entityNotFound(Account::class, (string)$query->id());
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Users/Domain/Services/Repositories/PermissionRepository.php:
--------------------------------------------------------------------------------
1 | includes());
15 | $qb->orderBy('name');
16 |
17 | (new ApplyApiExpressionsToDBALQueryBuilder([
18 | 'name' => 'r.name',
19 | ], [
20 | 'name' => 'ILIKE',
21 | ]))->apply($query->where(), $qb->getQueryBuilder());
22 |
23 | return $qb->paginate($query->page(), $query->perPage());
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Users/Application/QueryHandlers/DoesUserExistWithEmailQueryHandler.php:
--------------------------------------------------------------------------------
1 | whereColumn('email', '=', $query->email)->limit(1);
15 |
16 | if ($query->ignoreUser) {
17 | $qb->whereColumn('id', '!=', $query->ignoreUser);
18 | }
19 |
20 | try {
21 | return $qb->fetch()->count() > 0;
22 | } catch (EntityNotFoundException) {
23 | return false;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Users/Delivery/ViewModels/PermissionView.php:
--------------------------------------------------------------------------------
1 | 'datetime',
24 | ];
25 |
26 | protected array $exports = [
27 | 'attributes' => [
28 | 'name', 'created_at',
29 | ],
30 | 'relationships' => [
31 |
32 | ],
33 | ];
34 | }
35 |
--------------------------------------------------------------------------------
/src/Resources/Application/QueryHandlers/Behaviours/CanApplyOrderToQuery.php:
--------------------------------------------------------------------------------
1 | orderBy()->count()) {
16 | $qb->orderBy($field, $dir);
17 |
18 | return;
19 | }
20 |
21 | foreach ($query->orderBy() as $field => $dir) {
22 | if (in_array($field, $this->availableOrderFields)) {
23 | $qb->orderBy($field, $dir);
24 | }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Users/Application/QueryHandlers/GetPermissionByNameQueryHandler.php:
--------------------------------------------------------------------------------
1 | whereColumn('name', '=', $query->name)->fetchFirstOrFail();
17 | } catch (NoResultsException) {
18 | throw EntityNotFoundException::entityNotFound(Permission::class, (string)$query->name);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/docker-compose-test.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 |
3 | services:
4 | accounts-app:
5 | build:
6 | context: .
7 | dockerfile: config/docker/test/app/Dockerfile
8 | depends_on:
9 | - db-accounts
10 | networks:
11 | - backend
12 |
13 | accounts-redis:
14 | image: redis:alpine
15 | networks:
16 | - backend
17 |
18 | db-accounts:
19 | image: postgres:15-alpine
20 | environment:
21 | POSTGRES_DB: accounts
22 | POSTGRES_USER: mycompany
23 | POSTGRES_PASSWORD: secret
24 | volumes:
25 | - ./config/docker/test/db-accounts:/docker-entrypoint-initdb.d
26 | networks:
27 | - backend
28 |
29 | rabbitmq:
30 | image: rabbitmq:3.11-management-alpine
31 | environment:
32 | RABBITMQ_ERLANG_COOKIE: rabbitmqcookienamehere
33 | networks:
34 | - backend
35 |
36 | networks:
37 | backend:
38 | driver: bridge
39 |
--------------------------------------------------------------------------------
/src/Users/Delivery/Api/V1/Roles/Controllers/SearchController.php:
--------------------------------------------------------------------------------
1 | query()->execute($request->asQueryObject());
18 |
19 | return $this->paginate(PagerfantaType::fromFormRequest($request, $result, RoleViewTransformer::class));
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Users/Delivery/Api/V1/Users/Controllers/SearchController.php:
--------------------------------------------------------------------------------
1 | query()->execute($request->asQueryObject());
18 |
19 | return $this->paginate(PagerfantaType::fromFormRequest($request, $result, UserViewTransformer::class));
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Users/Application/QueryHandlers/GetRoleByIdQueryHandler.php:
--------------------------------------------------------------------------------
1 | include(...$query->includes());
17 |
18 | try {
19 | return $qb->findOrFail((string)$query->id());
20 | } catch (ReadModelNotFound) {
21 | throw EntityNotFoundException::entityNotFound(Role::class, (string)$query->id());
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Users/Infrastructure/Persistence/EntityLocators/RoleLocator.php:
--------------------------------------------------------------------------------
1 | include(...$query->includes())->orderBy('name');
17 |
18 | try {
19 | return $qb->findOrFail($query->id());
20 | } catch (ReadModelNotFound) {
21 | throw EntityNotFoundException::entityNotFound(User::class, (string)$query->id());
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Accounts/Delivery/Api/V1/Accounts/Controllers/SearchController.php:
--------------------------------------------------------------------------------
1 | query()->execute($request->asQueryObject());
18 |
19 | return $this->paginate(PagerfantaType::fromFormRequest($request, $result, AccountViewTransformer::class));
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tests/Users/Delivery/Api/V1/Permissions/DestroyPermissionsTest.php:
--------------------------------------------------------------------------------
1 | makeJsonRequestToNamedRoute('api.v1.permissions.create', [], 'POST', ['name' => 'my-permission'], 201);
23 |
24 | $this->makeJsonRequestToNamedRoute('api.v1.permissions.destroy', ['id' => 'my-permission'], 'DELETE', [], 204);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/config/docker/prod/app/docker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e
4 | cd /app
5 |
6 | cmd="$@"
7 |
8 | [[ -d "/app/var" ]] || mkdir -m 0777 "/app/var"
9 | [[ -d "/app/var/cache" ]] || mkdir -m 0777 "/app/var/cache"
10 | [[ -d "/app/var/logs" ]] || mkdir -m 0777 "/app/var/logs"
11 | [[ -d "/app/var/run" ]] || mkdir -m 0777 "/app/var/run"
12 | [[ -d "/app/var/run/ppm" ]] || mkdir -m 0777 "/app/var/run/ppm"
13 | [[ -d "/app/var/tmp" ]] || mkdir -m 0777 "/app/var/tmp"
14 |
15 | # allow for custom ppm settings
16 | if [[ ! -f "/app/ppm.json" ]]; then
17 | cp "/app/ppm.dist.json" "/app/ppm.json"
18 | fi
19 |
20 | # applying any outstanding migrations to avoid out-of-date dbs
21 | /app/bin/console doctrine:migrations:sync-metadata-storage
22 | /app/bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration
23 |
24 | sleep 5
25 |
26 | # run ppm, start should receive arguments from Dockerfile
27 | /usr/bin/ppm $cmd
28 |
--------------------------------------------------------------------------------
/config/docker/test/app/docker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e
4 | cd /app
5 |
6 | cmd="$@"
7 |
8 | [[ -d "/app/var" ]] || mkdir -m 0777 "/app/var"
9 | [[ -d "/app/var/cache" ]] || mkdir -m 0777 "/app/var/cache"
10 | [[ -d "/app/var/logs" ]] || mkdir -m 0777 "/app/var/logs"
11 | [[ -d "/app/var/run" ]] || mkdir -m 0777 "/app/var/run"
12 | [[ -d "/app/var/run/ppm" ]] || mkdir -m 0777 "/app/var/run/ppm"
13 | [[ -d "/app/var/tmp" ]] || mkdir -m 0777 "/app/var/tmp"
14 |
15 | # allow for custom ppm settings
16 | if [[ ! -f "/app/ppm.json" ]]; then
17 | cp "/app/ppm.dist.json" "/app/ppm.json"
18 | fi
19 |
20 | # applying any outstanding migrations to avoid out-of-date dbs
21 | /app/bin/console doctrine:migrations:sync-metadata-storage
22 | /app/bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration
23 |
24 | sleep 5
25 |
26 | # run ppm, start should receive arguments from Dockerfile
27 | /usr/bin/ppm $cmd
28 |
--------------------------------------------------------------------------------
/tests/DocumentationTest.php:
--------------------------------------------------------------------------------
1 | __kernelBrowserClient->request('GET', '/docs');
18 | $res = $this->__kernelBrowserClient->getResponse();
19 |
20 | $this->assertResponseIsSuccessful();
21 | $this->assertStringContainsString('