From e82c9eb35bea87084f326f7d2e4319de9c97e70e Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Thu, 30 Jul 2020 15:00:37 -0400 Subject: [PATCH 01/17] Refactor based on new core --- api/composer.json | 1 + api/composer.lock | 71 ++++++++++++++++++- .../fixtures/dev/access/role/permission.yaml | 2 - api/config/packages/doctrine.yaml | 12 ++++ api/config/tenant/loader/acl.yaml | 2 - api/src/Migration/Version0_19_0.php | 50 +++++++++++++ api/symfony.lock | 3 + 7 files changed, 134 insertions(+), 7 deletions(-) create mode 100644 api/src/Migration/Version0_19_0.php diff --git a/api/composer.json b/api/composer.json index f4a4ce3f..d107bb46 100644 --- a/api/composer.json +++ b/api/composer.json @@ -18,6 +18,7 @@ "knplabs/doctrine-behaviors": "^1.5", "lexik/jwt-authentication-bundle": "^2.6", "ramsey/uuid": "^3.8", + "scienta/doctrine-json-functions": "^4.1", "sensio/framework-extra-bundle": "^5.2", "sensiolabs/security-checker": "^5.0", "symfony/console": "^4.0", diff --git a/api/composer.lock b/api/composer.lock index 66cee8e9..b13fe5e8 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "64c705e08bb8fa4487bd287a3cc01993", + "content-hash": "a2551c8ae8a510b728b0b7f4a7720eb9", "packages": [ { "name": "api-platform/api-pack", @@ -2997,6 +2997,68 @@ ], "time": "2018-07-19T23:38:55+00:00" }, + { + "name": "scienta/doctrine-json-functions", + "version": "4.1.2", + "source": { + "type": "git", + "url": "https://github.com/ScientaNL/DoctrineJsonFunctions.git", + "reference": "6cab3f93a7415dbc889da15336c7605efbfe7bd4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ScientaNL/DoctrineJsonFunctions/zipball/6cab3f93a7415dbc889da15336c7605efbfe7bd4", + "reference": "6cab3f93a7415dbc889da15336c7605efbfe7bd4", + "shasum": "" + }, + "require": { + "ext-pdo": "*", + "php": "^7.1" + }, + "require-dev": { + "doctrine/coding-standard": "^5.0", + "doctrine/orm": "~2.6", + "phpunit/phpunit": "^6.5" + }, + "suggest": { + "dunglas/doctrine-json-odm": "To serialize / deserialize objects as JSON documents." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Scienta\\DoctrineJsonFunctions\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Doctrine Json Functions Contributors", + "homepage": "https://github.com/ScientaNL/DoctrineJsonFunctions/contributors" + } + ], + "description": "A set of extensions to Doctrine 2 that add support for json query functions.", + "keywords": [ + "database", + "doctrine", + "dql", + "json", + "mariadb", + "mysql", + "orm", + "postgres", + "postgresql", + "sqlite" + ], + "time": "2020-02-07T11:05:21+00:00" + }, { "name": "sensio/framework-extra-bundle", "version": "v5.2.4", @@ -6247,6 +6309,7 @@ "code", "zf2" ], + "abandoned": "laminas/laminas-code", "time": "2018-08-13T20:36:59+00:00" }, { @@ -6301,6 +6364,7 @@ "events", "zf2" ], + "abandoned": "laminas/laminas-eventmanager", "time": "2018-04-25T15:33:34+00:00" } ], @@ -7883,5 +7947,6 @@ "php": "^7.1.3", "ext-iconv": "*" }, - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "1.1.0" } diff --git a/api/config/fixtures/dev/access/role/permission.yaml b/api/config/fixtures/dev/access/role/permission.yaml index b1fce64d..a8d87349 100644 --- a/api/config/fixtures/dev/access/role/permission.yaml +++ b/api/config/fixtures/dev/access/role/permission.yaml @@ -3,7 +3,6 @@ objects: scope: type: owner entity: BusinessUnit - entity_uuid: ~ # Any BusinessUnit key: entity attributes: [BROWSE, READ, EDIT, ADD, DELETE] @@ -11,7 +10,6 @@ objects: scope: type: owner entity: BusinessUnit - entity_uuid: ~ # Any BusinessUnit key: property attributes: [BROWSE, READ, EDIT] diff --git a/api/config/packages/doctrine.yaml b/api/config/packages/doctrine.yaml index 02aef9d4..4ede26bd 100644 --- a/api/config/packages/doctrine.yaml +++ b/api/config/packages/doctrine.yaml @@ -7,6 +7,18 @@ doctrine: server_version: '9.6' url: '%env(resolve:DATABASE_URL)%' orm: + dql: + string_functions: + JSON_EXTRACT_PATH: Scienta\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonExtractPath + JSON_GET: Scienta\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonGet + JSON_GET_PATH: Scienta\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonGetPath + JSON_GET_PATH_TEXT: Scienta\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonGetPathText + JSON_GET_TEXT: Scienta\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonGetText + JSONB_CONTAINS: Scienta\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonbContains + JSONB_EXISTS: Scienta\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonbExists + JSONB_EXISTS_ALL: Scienta\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonbExistsAll + JSONB_EXISTS_ANY: Scienta\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonbExistsAny + JSONB_IS_CONTAINED: Scienta\DoctrineJsonFunctions\Query\AST\Functions\Postgresql\JsonbIsContained auto_generate_proxy_classes: '%kernel.debug%' naming_strategy: doctrine.orm.naming_strategy.underscore auto_mapping: true diff --git a/api/config/tenant/loader/acl.yaml b/api/config/tenant/loader/acl.yaml index 6f6130cb..0af652ff 100644 --- a/api/config/tenant/loader/acl.yaml +++ b/api/config/tenant/loader/acl.yaml @@ -25,13 +25,11 @@ objects: - scope: type: owner entity: BusinessUnit - entity_uuid: ~ key: entity attributes: [BROWSE, READ, EDIT, ADD, DELETE] - scope: type: owner entity: BusinessUnit - entity_uuid: ~ key: property attributes: [BROWSE, READ, EDIT] - scope: diff --git a/api/src/Migration/Version0_19_0.php b/api/src/Migration/Version0_19_0.php new file mode 100644 index 00000000..0f3121f1 --- /dev/null +++ b/api/src/Migration/Version0_19_0.php @@ -0,0 +1,50 @@ +acl = new Acl($version); + } + + /** + * Up migration + * + * @param \Doctrine\DBAL\Schema\Schema $schema + */ + public function up(Schema $schema) + { + $this->acl->up($schema); + } + + /** + * Down migration + * + * @param \Doctrine\DBAL\Schema\Schema $schema + */ + public function down(Schema $schema) + { + $this->acl->down($schema); + } +} diff --git a/api/symfony.lock b/api/symfony.lock index e08f1aca..67f9a301 100644 --- a/api/symfony.lock +++ b/api/symfony.lock @@ -245,6 +245,9 @@ "ramsey/uuid": { "version": "3.8.0" }, + "scienta/doctrine-json-functions": { + "version": "4.1.2" + }, "sensio/framework-extra-bundle": { "version": "5.2", "recipe": { From 7638e4328c11e44f39a11bc37dc996802479b58e Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Thu, 30 Jul 2020 15:34:26 -0400 Subject: [PATCH 02/17] Update api version --- api/config/packages/api_platform.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/config/packages/api_platform.yaml b/api/config/packages/api_platform.yaml index 73671610..5f1467a2 100644 --- a/api/config/packages/api_platform.yaml +++ b/api/config/packages/api_platform.yaml @@ -5,7 +5,7 @@ api_platform: mapping: paths: ['%kernel.project_dir%/src/Entity'] title: Services - version: 0.18.2 + version: 0.19.0 collection: pagination: page_parameter_name: _page From 212b0cebfdb244e995d7be78a03851248b2cab5c Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Thu, 30 Jul 2020 15:48:45 -0400 Subject: [PATCH 03/17] Update docker image version --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 16ede600..407da904 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,7 @@ services: - services_database php: - image: digitalstate/services:php-0.18.2 + image: digitalstate/services:php-0.19.0 depends_on: - database env_file: @@ -44,7 +44,7 @@ services: - services_php api: - image: digitalstate/services:api-0.18.2 + image: digitalstate/services:api-0.19.0 depends_on: - php networks: From d1c956f22a1adc860e5834761dfb9574b13cdd4d Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 2 Aug 2020 07:12:30 -0400 Subject: [PATCH 04/17] Update digitalstate/core dependency --- api/composer.json | 2 +- api/composer.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/composer.json b/api/composer.json index d107bb46..f947077d 100644 --- a/api/composer.json +++ b/api/composer.json @@ -11,7 +11,7 @@ "ext-iconv": "*", "api-platform/api-pack": "^1.1", "defuse/php-encryption": "^2.2", - "digitalstate/core": "0.18.0", + "digitalstate/core": "0.19.0", "doctrine/doctrine-fixtures-bundle": "^3.0", "doctrine/doctrine-migrations-bundle": "^1.3", "guzzlehttp/guzzle": "^6.3", diff --git a/api/composer.lock b/api/composer.lock index b13fe5e8..d86fbdb0 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -330,16 +330,16 @@ }, { "name": "digitalstate/core", - "version": "0.18.0", + "version": "0.19.0", "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "c94e4b990ef1a7f1adc76b89d06d95f6a47721ec" + "reference": "7caa21bd878923e318dc5e4b214846fb11eae96c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/c94e4b990ef1a7f1adc76b89d06d95f6a47721ec", - "reference": "c94e4b990ef1a7f1adc76b89d06d95f6a47721ec", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/7caa21bd878923e318dc5e4b214846fb11eae96c", + "reference": "7caa21bd878923e318dc5e4b214846fb11eae96c", "shasum": "" }, "require": { From 6a1b57a720d38c8ee17530a256d7234c1d8320c2 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 2 Aug 2020 07:57:19 -0400 Subject: [PATCH 05/17] Update digitalstate/core dependency --- api/composer.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/composer.lock b/api/composer.lock index d86fbdb0..2284fa82 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "7caa21bd878923e318dc5e4b214846fb11eae96c" + "reference": "4c2371640e087c2490231085d8df7f9109e9bda3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/7caa21bd878923e318dc5e4b214846fb11eae96c", - "reference": "7caa21bd878923e318dc5e4b214846fb11eae96c", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/4c2371640e087c2490231085d8df7f9109e9bda3", + "reference": "4c2371640e087c2490231085d8df7f9109e9bda3", "shasum": "" }, "require": { From 1141d677ba8b04de134b9ca0a870ebcbcee7482d Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Mon, 3 Aug 2020 16:40:23 -0400 Subject: [PATCH 06/17] Update to latest digitalstate/core dependency --- api/composer.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/composer.lock b/api/composer.lock index 2284fa82..4841bc4a 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "4c2371640e087c2490231085d8df7f9109e9bda3" + "reference": "f2a5b5972e56266978e44bfde920ed726357739a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/4c2371640e087c2490231085d8df7f9109e9bda3", - "reference": "4c2371640e087c2490231085d8df7f9109e9bda3", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/f2a5b5972e56266978e44bfde920ed726357739a", + "reference": "f2a5b5972e56266978e44bfde920ed726357739a", "shasum": "" }, "require": { From 027caa878a8feb7fdb860b1a3fa4b08a1fdfe448 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Wed, 5 Aug 2020 18:54:53 -0400 Subject: [PATCH 07/17] Update digitalstate/core dependency --- api/composer.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/composer.lock b/api/composer.lock index 4841bc4a..facf28af 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "f2a5b5972e56266978e44bfde920ed726357739a" + "reference": "7ffdb4a9d467390862d0bd223447893e5b206df0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/f2a5b5972e56266978e44bfde920ed726357739a", - "reference": "f2a5b5972e56266978e44bfde920ed726357739a", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/7ffdb4a9d467390862d0bd223447893e5b206df0", + "reference": "7ffdb4a9d467390862d0bd223447893e5b206df0", "shasum": "" }, "require": { From eb6b43621ea3015bb1d9374937736ba09f78b804 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Thu, 6 Aug 2020 17:42:21 -0400 Subject: [PATCH 08/17] Update to latest digitalstate/core dependency --- api/composer.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/composer.lock b/api/composer.lock index facf28af..9d535739 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "7ffdb4a9d467390862d0bd223447893e5b206df0" + "reference": "ac3da6f8fd4e79933769f01253ab96d552b33776" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/7ffdb4a9d467390862d0bd223447893e5b206df0", - "reference": "7ffdb4a9d467390862d0bd223447893e5b206df0", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/ac3da6f8fd4e79933769f01253ab96d552b33776", + "reference": "ac3da6f8fd4e79933769f01253ab96d552b33776", "shasum": "" }, "require": { From 41fdb3b92ef36efcd07974bae856322ec3b25785 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 9 Aug 2020 21:12:39 -0400 Subject: [PATCH 09/17] Update behat tests --- api/composer.lock | 6 +- .../fixtures/test/access/role/access.yaml | 9 +- .../fixtures/test/access/role/permission.yaml | 35 +++++- api/config/fixtures/test/config.yaml | 108 ++++++++++++++++++ api/config/fixtures/test/metadata.yaml | 2 + api/config/fixtures/test/service.yaml | 38 ++++++ api/config/fixtures/test/system/tenant.yaml | 2 + api/features/api/access/add.feature | 4 +- .../api/security/acl/services.feature | 57 +++++++++ api/features/api/service/add.feature | 4 +- api/features/api/system/tenant/add.feature | 4 +- api/features/api/system/tenant/browse.feature | 4 +- 12 files changed, 260 insertions(+), 13 deletions(-) create mode 100644 api/features/api/security/acl/services.feature diff --git a/api/composer.lock b/api/composer.lock index 9d535739..70e25e37 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "ac3da6f8fd4e79933769f01253ab96d552b33776" + "reference": "43e1155fae8e6610964893b0fe520de8848abd3a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/ac3da6f8fd4e79933769f01253ab96d552b33776", - "reference": "ac3da6f8fd4e79933769f01253ab96d552b33776", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/43e1155fae8e6610964893b0fe520de8848abd3a", + "reference": "43e1155fae8e6610964893b0fe520de8848abd3a", "shasum": "" }, "require": { diff --git a/api/config/fixtures/test/access/role/access.yaml b/api/config/fixtures/test/access/role/access.yaml index fb18ad2b..d61a508e 100644 --- a/api/config/fixtures/test/access/role/access.yaml +++ b/api/config/fixtures/test/access/role/access.yaml @@ -1,4 +1,11 @@ -objects: [] +objects: + - uuid: bf5488c4-0cfa-42b8-b21a-5cdf61adf335 + assignee_uuid: 3762b831-1bb7-438d-9747-1b8657e59877 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: ef8b15dd-9260-4847-afc6-a61ef891312e + assignee_uuid: de3d2dea-ab7c-472d-85f0-c7df3db8a690 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 prototype: uuid: ~ diff --git a/api/config/fixtures/test/access/role/permission.yaml b/api/config/fixtures/test/access/role/permission.yaml index a50e99b7..24eb0fea 100644 --- a/api/config/fixtures/test/access/role/permission.yaml +++ b/api/config/fixtures/test/access/role/permission.yaml @@ -1,4 +1,37 @@ -objects: [] +objects: + - access: bf5488c4-0cfa-42b8-b21a-5cdf61adf335 + key: entity + attributes: [BROWSE, READ, EDIT, ADD, DELETE] + scope: + type: owner + entity: BusinessUnit + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: bf5488c4-0cfa-42b8-b21a-5cdf61adf335 + key: property + attributes: [BROWSE, READ, EDIT] + scope: + type: owner + entity: BusinessUnit + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: ef8b15dd-9260-4847-afc6-a61ef891312e + key: entity + attributes: [BROWSE, READ, EDIT, ADD, DELETE] + scope: + type: property + property: data.en.attribute + value: string + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: ef8b15dd-9260-4847-afc6-a61ef891312e + key: property + attributes: [BROWSE, READ, EDIT] + scope: + type: property + property: data.en.attribute + value: string + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 prototype: access: ~ diff --git a/api/config/fixtures/test/config.yaml b/api/config/fixtures/test/config.yaml index 7e62e6df..d1c0096f 100644 --- a/api/config/fixtures/test/config.yaml +++ b/api/config/fixtures/test/config.yaml @@ -215,6 +215,114 @@ objects: value: start_data tenant: 92000deb-b847-4838-915c-b95d2b28e960 # Tenant 2 + - uuid: 9999ba4e-ef33-41e3-8b7c-be05e4d46a9b + owner_uuid: ~ + key: ds_api.user.username + value: system@system.ds + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: d2c40a9e-9db9-4e8a-bfe0-4dce0540bd08 + owner_uuid: ~ + key: ds_api.user.password + value: system + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 721d69c1-512f-4d93-a105-cbcf44654c6c + owner_uuid: ~ + key: ds_api.user.uuid + value: d6a5c45e-2e14-4dd0-b1eb-7bd36db3fcf6 # System + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 5e296cc4-203b-4295-b90c-0f294fc82c7d + owner_uuid: ~ + key: ds_api.user.roles + value: [] + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: cb90bc72-baf0-4e57-8912-eae2091034df + owner_uuid: ~ + key: ds_api.user.identity.roles + value: [] + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: e9b10ad1-9d76-4b51-a6b9-5e74b0679fa4 + owner_uuid: ~ + key: ds_api.user.identity.type + value: System + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: eecbe53c-109e-4998-9baa-9c55e331a218 + owner_uuid: ~ + key: ds_api.user.identity.uuid + value: ~ + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 39b1a45a-26be-4f1e-bf1c-1b8c472d215c + owner_uuid: ~ + key: ds_api.user.tenant + value: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 86e89dd7-03ef-4ba4-a721-2968009a4d23 + owner_uuid: ~ + key: app.bpm.variables.api_url + value: api_url + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 833aa77b-726f-4aa0-a59b-c9813e5e8d82 + owner_uuid: ~ + key: app.bpm.variables.api_user + value: api_user + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 9a9c5298-3c76-4f45-8b0a-e98234ab8f2a + owner_uuid: ~ + key: app.bpm.variables.api_key + value: api_key + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 5fc5cade-82de-49f1-adca-e3310f9fa1bb + owner_uuid: ~ + key: app.bpm.variables.service_uuid + value: service_uuid + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 13bd6c35-84be-4309-99da-81ace8eb07de + owner_uuid: ~ + key: app.bpm.variables.scenario_uuid + value: scenario_uuid + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 5f01d184-df91-42c4-9237-ae343b8e41f6 + owner_uuid: ~ + key: app.bpm.variables.scenario_custom_data + value: scenario_custom_data + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 33b74b4f-4f1a-4633-8b67-ef18f594ffb3 + owner_uuid: ~ + key: app.bpm.variables.identity + value: identity + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 11439bc9-098c-4189-818d-b93daf01fa48 + owner_uuid: ~ + key: app.bpm.variables.identity_uuid + value: identity_uuid + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 943f61a2-c90a-482a-b7b7-b1bf88f28523 + owner_uuid: ~ + key: app.bpm.variables.submission_uuid + value: submission_uuid + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 0bfe25ba-d6c1-4401-a8e1-4afdd69cd5c2 + owner_uuid: ~ + key: app.bpm.variables.start_data + value: start_data + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + prototype: uuid: ~ owner: BusinessUnit diff --git a/api/config/fixtures/test/metadata.yaml b/api/config/fixtures/test/metadata.yaml index bdd3feab..01da4a49 100644 --- a/api/config/fixtures/test/metadata.yaml +++ b/api/config/fixtures/test/metadata.yaml @@ -13,6 +13,7 @@ objects: identity: Identity owner: Owner session: Session + property: Property tenant: b6ac25fe-3cd6-4100-a054-6bba2fc9ef18 # Tenant 1 - uuid: 50d8d791-1771-4f70-aaa7-188c181d3182 @@ -29,6 +30,7 @@ objects: identity: Identity owner: Owner session: Session + property: Property tenant: 92000deb-b847-4838-915c-b95d2b28e960 # Tenant 2 prototype: diff --git a/api/config/fixtures/test/service.yaml b/api/config/fixtures/test/service.yaml index be7a05e2..bd182619 100644 --- a/api/config/fixtures/test/service.yaml +++ b/api/config/fixtures/test/service.yaml @@ -55,6 +55,44 @@ objects: fr: Presentation ... tenant: 92000deb-b847-4838-915c-b95d2b28e960 # Tenant 2 + - uuid: 3302e49b-03b0-40c9-8845-4243ca2c0051 + owner_uuid: ~ + slug: service-1 + title: + en: Service 1 + fr: Service 1 + description: + en: Description ... + fr: Description ... + presentation: + en: Presentation ... + fr: Presentation ... + data: + en: + attribute: "string" + fr: + attribute: "string" + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: dcdbbb1b-0762-4254-a1c5-33080749d5b3 + owner_uuid: ~ + slug: service-2 + title: + en: Service 2 + fr: Service 2 + description: + en: Description ... + fr: Description ... + presentation: + en: Presentation ... + fr: Presentation ... + data: + en: + attribute: 123 + fr: + attribute: 123 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + prototype: uuid: ~ owner: BusinessUnit diff --git a/api/config/fixtures/test/system/tenant.yaml b/api/config/fixtures/test/system/tenant.yaml index 748d82c3..7be4c9d0 100644 --- a/api/config/fixtures/test/system/tenant.yaml +++ b/api/config/fixtures/test/system/tenant.yaml @@ -3,6 +3,8 @@ objects: - uuid: 92000deb-b847-4838-915c-b95d2b28e960 # Tenant 2 + - uuid: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + prototype: uuid: ~ data: {} diff --git a/api/features/api/access/add.feature b/api/features/api/access/add.feature index fdae0d84..b70d3979 100644 --- a/api/features/api/access/add.feature +++ b/api/features/api/access/add.feature @@ -22,7 +22,7 @@ Feature: Add accesses And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON And the JSON node "id" should exist - And the JSON node "id" should be equal to the number 19 + And the JSON node "id" should be equal to the number 21 And the JSON node "uuid" should exist And the JSON node "createdAt" should exist And the JSON node "updatedAt" should exist @@ -39,7 +39,7 @@ Feature: Add accesses Scenario: Read the added access When I add "Accept" header equal to "application/json" - And I send a "GET" request to "/accesses?id=19" + And I send a "GET" request to "/accesses?id=21" Then the response status code should be 200 And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON diff --git a/api/features/api/security/acl/services.feature b/api/features/api/security/acl/services.feature new file mode 100644 index 00000000..137a492b --- /dev/null +++ b/api/features/api/security/acl/services.feature @@ -0,0 +1,57 @@ +@api @security @acl @service +Feature: Validate acl permissions on service endpoints + + Scenario: Browse all services with permission scope `owner = BusinessUnit` + Given I am authenticated as the "system@system.ds" user with identity role "3762b831-1bb7-438d-9747-1b8657e59877" from the tenant "64c82518-017d-4fb2-9fcf-3926da3616e6" + When I add "Accept" header equal to "application/json" + And I send a "GET" request to "/services" + Then the response status code should be 200 + And the header "Content-Type" should be equal to "application/json; charset=utf-8" + And the response should be in JSON + And the JSON should be valid according to this schema: + """ + { + "type": "array", + "minItems": 2, + "maxItems": 2, + "items": { + "type": "object", + "properties": { + "uuid": { + "type": "string", + "enum": [ + "3302e49b-03b0-40c9-8845-4243ca2c0051", + "dcdbbb1b-0762-4254-a1c5-33080749d5b3" + ] + } + } + } + } + """ + + Scenario: Browse all services with permission scope `data.en.attribute = "string"` + Given I am authenticated as the "system@system.ds" user with identity role "de3d2dea-ab7c-472d-85f0-c7df3db8a690" from the tenant "64c82518-017d-4fb2-9fcf-3926da3616e6" + When I add "Accept" header equal to "application/json" + And I send a "GET" request to "/services" + Then the response status code should be 200 + And the header "Content-Type" should be equal to "application/json; charset=utf-8" + And the response should be in JSON + And the JSON should be valid according to this schema: + """ + { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "properties": { + "uuid": { + "type": "string", + "enum": [ + "3302e49b-03b0-40c9-8845-4243ca2c0051" + ] + } + } + } + } + """ diff --git a/api/features/api/service/add.feature b/api/features/api/service/add.feature index 0dbee320..5d9ff4ae 100644 --- a/api/features/api/service/add.feature +++ b/api/features/api/service/add.feature @@ -42,7 +42,7 @@ Feature: Add services And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON And the JSON node "id" should exist - And the JSON node "id" should be equal to the number 5 + And the JSON node "id" should be equal to the number 7 And the JSON node "uuid" should exist And the JSON node "createdAt" should exist And the JSON node "updatedAt" should exist @@ -89,7 +89,7 @@ Feature: Add services Scenario: Read the added service When I add "Accept" header equal to "application/json" - And I send a "GET" request to "/services?id=5" + And I send a "GET" request to "/services?id=7" Then the response status code should be 200 And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON diff --git a/api/features/api/system/tenant/add.feature b/api/features/api/system/tenant/add.feature index ae37de8b..2c4f93cb 100644 --- a/api/features/api/system/tenant/add.feature +++ b/api/features/api/system/tenant/add.feature @@ -66,7 +66,7 @@ Feature: Add tenant And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON And the JSON node "id" should exist - And the JSON node "id" should be equal to the number 3 + And the JSON node "id" should be equal to the number 4 And the JSON node "uuid" should exist And the JSON node "uuid" should be equal to "3b0f1019-e9b6-458d-b9ad-fd60c079ee7b" And the JSON node "createdAt" should exist @@ -76,7 +76,7 @@ Feature: Add tenant Scenario: Read the added tenant When I add "Accept" header equal to "application/json" - And I send a "GET" request to "/system/tenants?id=3" + And I send a "GET" request to "/system/tenants?id=4" Then the response status code should be 200 And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON diff --git a/api/features/api/system/tenant/browse.feature b/api/features/api/system/tenant/browse.feature index 6e0b1697..f339c349 100644 --- a/api/features/api/system/tenant/browse.feature +++ b/api/features/api/system/tenant/browse.feature @@ -14,8 +14,8 @@ Feature: Browse tenants """ { "type": "array", - "minItems": 2, - "maxItems": 2, + "minItems": 3, + "maxItems": 3, "items": { "type": "object", "properties": { From 2285349c449bf8c094a78a7855d02517a10a3ed2 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 30 Aug 2020 14:57:17 -0400 Subject: [PATCH 10/17] Enable write on entity created_at properties --- api/composer.lock | 6 +++--- api/config/fixtures/dev/access/anonymous/access.yaml | 1 + api/config/fixtures/dev/access/individual/access.yaml | 1 + api/config/fixtures/dev/access/organization/access.yaml | 1 + api/config/fixtures/dev/access/role/access.yaml | 1 + api/config/fixtures/dev/access/staff/access.yaml | 1 + api/config/fixtures/dev/access/system/access.yaml | 1 + api/config/fixtures/dev/category.yaml | 1 + api/config/fixtures/dev/config.yaml | 1 + api/config/fixtures/dev/metadata.yaml | 1 + api/config/fixtures/dev/scenario.yaml | 1 + api/config/fixtures/dev/service.yaml | 1 + api/config/fixtures/dev/system/tenant.yaml | 1 + api/config/fixtures/test/access/anonymous/access.yaml | 1 + api/config/fixtures/test/access/individual/access.yaml | 1 + api/config/fixtures/test/access/organization/access.yaml | 1 + api/config/fixtures/test/access/role/access.yaml | 1 + api/config/fixtures/test/access/staff/access.yaml | 1 + api/config/fixtures/test/access/system/access.yaml | 1 + api/config/fixtures/test/category.yaml | 1 + api/config/fixtures/test/config.yaml | 1 + api/config/fixtures/test/metadata.yaml | 1 + api/config/fixtures/test/scenario.yaml | 1 + api/config/fixtures/test/service.yaml | 1 + api/config/fixtures/test/system/tenant.yaml | 1 + api/docker/php/docker-entrypoint.sh | 4 ++-- api/features/api/access/add.feature | 2 ++ api/features/api/access/edit.feature | 6 +++--- api/features/api/category/add.feature | 2 ++ api/features/api/category/edit.feature | 6 +++--- api/features/api/config/edit.feature | 6 +++--- api/features/api/metadata/add.feature | 2 ++ api/features/api/metadata/edit.feature | 6 +++--- api/features/api/scenario/add.feature | 2 ++ api/features/api/scenario/edit.feature | 6 +++--- api/features/api/service/add.feature | 2 ++ api/features/api/service/edit.feature | 6 +++--- api/src/Entity/Category.php | 5 +++-- api/src/Entity/Scenario.php | 5 +++-- api/src/Entity/Service.php | 5 +++-- api/src/Entity/Submission.php | 5 +++-- api/src/Fixture/Category.php | 7 +++++++ api/src/Fixture/Scenario.php | 8 ++++++++ api/src/Fixture/Service.php | 8 ++++++++ 44 files changed, 92 insertions(+), 31 deletions(-) diff --git a/api/composer.lock b/api/composer.lock index 70e25e37..21cf89f2 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "43e1155fae8e6610964893b0fe520de8848abd3a" + "reference": "c762a4f7a9ed1815742564d7890f8652d65dc3d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/43e1155fae8e6610964893b0fe520de8848abd3a", - "reference": "43e1155fae8e6610964893b0fe520de8848abd3a", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/c762a4f7a9ed1815742564d7890f8652d65dc3d0", + "reference": "c762a4f7a9ed1815742564d7890f8652d65dc3d0", "shasum": "" }, "require": { diff --git a/api/config/fixtures/dev/access/anonymous/access.yaml b/api/config/fixtures/dev/access/anonymous/access.yaml index 7f5aaa3a..986ba357 100644 --- a/api/config/fixtures/dev/access/anonymous/access.yaml +++ b/api/config/fixtures/dev/access/anonymous/access.yaml @@ -3,6 +3,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: c11c546e-bd01-47cf-97da-e25388357b5a # Administration assignee: Anonymous diff --git a/api/config/fixtures/dev/access/individual/access.yaml b/api/config/fixtures/dev/access/individual/access.yaml index dfe7630b..3318fddf 100644 --- a/api/config/fixtures/dev/access/individual/access.yaml +++ b/api/config/fixtures/dev/access/individual/access.yaml @@ -2,6 +2,7 @@ objects: [] prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: c11c546e-bd01-47cf-97da-e25388357b5a # Administration assignee: Individual diff --git a/api/config/fixtures/dev/access/organization/access.yaml b/api/config/fixtures/dev/access/organization/access.yaml index d49418a3..23d354ec 100644 --- a/api/config/fixtures/dev/access/organization/access.yaml +++ b/api/config/fixtures/dev/access/organization/access.yaml @@ -2,6 +2,7 @@ objects: [] prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: c11c546e-bd01-47cf-97da-e25388357b5a # Administration assignee: Organization diff --git a/api/config/fixtures/dev/access/role/access.yaml b/api/config/fixtures/dev/access/role/access.yaml index ae9f15f6..2865f0c0 100644 --- a/api/config/fixtures/dev/access/role/access.yaml +++ b/api/config/fixtures/dev/access/role/access.yaml @@ -16,6 +16,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: c11c546e-bd01-47cf-97da-e25388357b5a # Administration assignee: Role diff --git a/api/config/fixtures/dev/access/staff/access.yaml b/api/config/fixtures/dev/access/staff/access.yaml index 3546239f..0989c220 100644 --- a/api/config/fixtures/dev/access/staff/access.yaml +++ b/api/config/fixtures/dev/access/staff/access.yaml @@ -2,6 +2,7 @@ objects: [] prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: c11c546e-bd01-47cf-97da-e25388357b5a # Administration assignee: Staff diff --git a/api/config/fixtures/dev/access/system/access.yaml b/api/config/fixtures/dev/access/system/access.yaml index 966ab3e9..a1596ff9 100644 --- a/api/config/fixtures/dev/access/system/access.yaml +++ b/api/config/fixtures/dev/access/system/access.yaml @@ -9,6 +9,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: System owner_uuid: ~ assignee: System diff --git a/api/config/fixtures/dev/category.yaml b/api/config/fixtures/dev/category.yaml index b1bdef93..7b0aac8d 100644 --- a/api/config/fixtures/dev/category.yaml +++ b/api/config/fixtures/dev/category.yaml @@ -32,6 +32,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ slug: ~ diff --git a/api/config/fixtures/dev/config.yaml b/api/config/fixtures/dev/config.yaml index bafb97d7..ee818382 100644 --- a/api/config/fixtures/dev/config.yaml +++ b/api/config/fixtures/dev/config.yaml @@ -73,6 +73,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: c11c546e-bd01-47cf-97da-e25388357b5a # Administration key: ~ diff --git a/api/config/fixtures/dev/metadata.yaml b/api/config/fixtures/dev/metadata.yaml index 8130c481..16c78283 100644 --- a/api/config/fixtures/dev/metadata.yaml +++ b/api/config/fixtures/dev/metadata.yaml @@ -2,6 +2,7 @@ objects: [] prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: c11c546e-bd01-47cf-97da-e25388357b5a # Administration title: {} diff --git a/api/config/fixtures/dev/scenario.yaml b/api/config/fixtures/dev/scenario.yaml index 5f9510c7..2dcf6ba6 100644 --- a/api/config/fixtures/dev/scenario.yaml +++ b/api/config/fixtures/dev/scenario.yaml @@ -89,6 +89,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ service: ~ diff --git a/api/config/fixtures/dev/service.yaml b/api/config/fixtures/dev/service.yaml index 767d6041..c2c50ef1 100644 --- a/api/config/fixtures/dev/service.yaml +++ b/api/config/fixtures/dev/service.yaml @@ -40,6 +40,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ slug: ~ diff --git a/api/config/fixtures/dev/system/tenant.yaml b/api/config/fixtures/dev/system/tenant.yaml index feb49483..a0dbc08a 100644 --- a/api/config/fixtures/dev/system/tenant.yaml +++ b/api/config/fixtures/dev/system/tenant.yaml @@ -3,4 +3,5 @@ objects: prototype: uuid: ~ + created_at: ~ data: {} diff --git a/api/config/fixtures/test/access/anonymous/access.yaml b/api/config/fixtures/test/access/anonymous/access.yaml index 052bd4cc..0de1a5c5 100644 --- a/api/config/fixtures/test/access/anonymous/access.yaml +++ b/api/config/fixtures/test/access/anonymous/access.yaml @@ -19,6 +19,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ assignee: Anonymous diff --git a/api/config/fixtures/test/access/individual/access.yaml b/api/config/fixtures/test/access/individual/access.yaml index 88bb188a..d2a6fec1 100644 --- a/api/config/fixtures/test/access/individual/access.yaml +++ b/api/config/fixtures/test/access/individual/access.yaml @@ -19,6 +19,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ assignee: Individual diff --git a/api/config/fixtures/test/access/organization/access.yaml b/api/config/fixtures/test/access/organization/access.yaml index ba555c77..cffa56c7 100644 --- a/api/config/fixtures/test/access/organization/access.yaml +++ b/api/config/fixtures/test/access/organization/access.yaml @@ -19,6 +19,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ assignee: Organization diff --git a/api/config/fixtures/test/access/role/access.yaml b/api/config/fixtures/test/access/role/access.yaml index d61a508e..ac545dfe 100644 --- a/api/config/fixtures/test/access/role/access.yaml +++ b/api/config/fixtures/test/access/role/access.yaml @@ -9,6 +9,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ assignee: Role diff --git a/api/config/fixtures/test/access/staff/access.yaml b/api/config/fixtures/test/access/staff/access.yaml index c6f3874a..97822a5a 100644 --- a/api/config/fixtures/test/access/staff/access.yaml +++ b/api/config/fixtures/test/access/staff/access.yaml @@ -19,6 +19,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ assignee: Staff diff --git a/api/config/fixtures/test/access/system/access.yaml b/api/config/fixtures/test/access/system/access.yaml index e2b943a9..901078dd 100644 --- a/api/config/fixtures/test/access/system/access.yaml +++ b/api/config/fixtures/test/access/system/access.yaml @@ -11,6 +11,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: System owner_uuid: ~ assignee: System diff --git a/api/config/fixtures/test/category.yaml b/api/config/fixtures/test/category.yaml index 2222b63b..c407b4e0 100644 --- a/api/config/fixtures/test/category.yaml +++ b/api/config/fixtures/test/category.yaml @@ -61,6 +61,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ slug: ~ diff --git a/api/config/fixtures/test/config.yaml b/api/config/fixtures/test/config.yaml index d1c0096f..b3ef2126 100644 --- a/api/config/fixtures/test/config.yaml +++ b/api/config/fixtures/test/config.yaml @@ -325,6 +325,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ key: ~ diff --git a/api/config/fixtures/test/metadata.yaml b/api/config/fixtures/test/metadata.yaml index 01da4a49..e7e66537 100644 --- a/api/config/fixtures/test/metadata.yaml +++ b/api/config/fixtures/test/metadata.yaml @@ -35,6 +35,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ title: {} diff --git a/api/config/fixtures/test/scenario.yaml b/api/config/fixtures/test/scenario.yaml index b55cc983..8af7f1a5 100644 --- a/api/config/fixtures/test/scenario.yaml +++ b/api/config/fixtures/test/scenario.yaml @@ -51,6 +51,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ service: ~ diff --git a/api/config/fixtures/test/service.yaml b/api/config/fixtures/test/service.yaml index bd182619..0607edb1 100644 --- a/api/config/fixtures/test/service.yaml +++ b/api/config/fixtures/test/service.yaml @@ -95,6 +95,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ slug: ~ diff --git a/api/config/fixtures/test/system/tenant.yaml b/api/config/fixtures/test/system/tenant.yaml index 7be4c9d0..8566697b 100644 --- a/api/config/fixtures/test/system/tenant.yaml +++ b/api/config/fixtures/test/system/tenant.yaml @@ -7,4 +7,5 @@ objects: prototype: uuid: ~ + created_at: ~ data: {} diff --git a/api/docker/php/docker-entrypoint.sh b/api/docker/php/docker-entrypoint.sh index 95668d25..bf12dced 100644 --- a/api/docker/php/docker-entrypoint.sh +++ b/api/docker/php/docker-entrypoint.sh @@ -8,8 +8,8 @@ fi if [ "$1" = 'php-fpm' ] || [ "$1" = 'bin/console' ]; then mkdir -p var/cache var/log - setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX var - setfacl -dR -m u:www-data:rwX -m u:"$(whoami)":rwX var +# setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX var +# setfacl -dR -m u:www-data:rwX -m u:"$(whoami)":rwX var if [ "$APP_ENV" != 'prod' ]; then composer install --prefer-dist --no-progress --no-suggest --no-interaction diff --git a/api/features/api/access/add.feature b/api/features/api/access/add.feature index b70d3979..c6b827bb 100644 --- a/api/features/api/access/add.feature +++ b/api/features/api/access/add.feature @@ -10,6 +10,7 @@ Feature: Add accesses And I send a "POST" request to "/accesses" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "BusinessUnit", "ownerUuid": "325e1004-8516-4ca9-a4d3-d7505bd9a7fe", "assignee": "Anonymous", @@ -25,6 +26,7 @@ Feature: Add accesses And the JSON node "id" should be equal to the number 21 And the JSON node "uuid" should exist And the JSON node "createdAt" should exist + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should exist And the JSON node "owner" should exist And the JSON node "owner" should be equal to the string "BusinessUnit" diff --git a/api/features/api/access/edit.feature b/api/features/api/access/edit.feature index aabcf740..d1185a18 100644 --- a/api/features/api/access/edit.feature +++ b/api/features/api/access/edit.feature @@ -10,6 +10,7 @@ Feature: Edit accesses And I send a "PUT" request to "/accesses/06dd7640-fcd3-4f42-90b6-659caa06d794" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "System", "ownerUuid": "aa18b644-a503-49fa-8f53-10f4c1f8e3a1", "assignee": "System", @@ -20,6 +21,7 @@ Feature: Edit accesses Then the response status code should be 200 And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "owner" should be equal to the string "System" And the JSON node "ownerUuid" should be equal to the string "aa18b644-a503-49fa-8f53-10f4c1f8e3a1" And the JSON node "assignee" should be equal to the string "System" @@ -32,6 +34,7 @@ Feature: Edit accesses Then the response status code should be 200 And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "owner" should be equal to the string "System" And the JSON node "ownerUuid" should be equal to the string "aa18b644-a503-49fa-8f53-10f4c1f8e3a1" And the JSON node "assignee" should be equal to the string "System" @@ -46,7 +49,6 @@ Feature: Edit accesses { "id": 9999, "uuid": "1ac1b01e-4934-4b89-8a43-7d17a849be61", - "createdAt":"2000-01-01T12:00:00+00:00", "updatedAt":"2000-01-01T12:00:00+00:00", "version": 2, "tenant": "93377748-2abb-4e33-9027-5d8a5c281a41" @@ -57,7 +59,6 @@ Feature: Edit accesses And the response should be in JSON And the JSON node "id" should be equal to the number 1 And the JSON node "uuid" should be equal to the string "06dd7640-fcd3-4f42-90b6-659caa06d794" - And the JSON node "createdAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "tenant" should be equal to "b6ac25fe-3cd6-4100-a054-6bba2fc9ef18" @@ -69,7 +70,6 @@ Feature: Edit accesses And the response should be in JSON And the JSON node "id" should be equal to the number 1 And the JSON node "uuid" should be equal to the string "06dd7640-fcd3-4f42-90b6-659caa06d794" - And the JSON node "createdAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "tenant" should be equal to "b6ac25fe-3cd6-4100-a054-6bba2fc9ef18" diff --git a/api/features/api/category/add.feature b/api/features/api/category/add.feature index ddd61f04..938f4957 100644 --- a/api/features/api/category/add.feature +++ b/api/features/api/category/add.feature @@ -10,6 +10,7 @@ Feature: Add categories And I send a "POST" request to "/categories" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "BusinessUnit", "ownerUuid": "83bf8f26-7181-4bed-92f3-3ce5e4c286d7", "slug": "slug-add", @@ -45,6 +46,7 @@ Feature: Add categories And the JSON node "id" should be equal to the number 5 And the JSON node "uuid" should exist And the JSON node "createdAt" should exist + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should exist And the JSON node "deletedAt" should exist And the JSON node "deletedAt" should be null diff --git a/api/features/api/category/edit.feature b/api/features/api/category/edit.feature index 7002536a..3c1fe5a6 100644 --- a/api/features/api/category/edit.feature +++ b/api/features/api/category/edit.feature @@ -10,6 +10,7 @@ Feature: Edit categories And I send a "PUT" request to "/categories/70f36469-a65c-4d81-ae15-d66a2ef90df0" with body: """ { + "createdAt": "2000-01-01 12:00:00", "ownerUuid": "325e1004-8516-4ca9-a4d3-d7505bd9a7fe", "slug": "infrastructure-edit", "title": { @@ -39,6 +40,7 @@ Feature: Edit categories Then the response status code should be 200 And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "ownerUuid" should be equal to the string "325e1004-8516-4ca9-a4d3-d7505bd9a7fe" And the JSON node "slug" should be equal to the string "infrastructure-edit" And the JSON node "title.en" should be equal to "Infrastructure - edit" @@ -59,6 +61,7 @@ Feature: Edit categories Then the response status code should be 200 And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "ownerUuid" should be equal to the string "325e1004-8516-4ca9-a4d3-d7505bd9a7fe" And the JSON node "slug" should be equal to the string "infrastructure-edit" And the JSON node "title.en" should be equal to "Infrastructure - edit" @@ -81,7 +84,6 @@ Feature: Edit categories { "id": 9999, "uuid": "25cfe5bb-b52d-4d33-9b54-5ed189cbcd2c", - "createdAt":"2000-01-01T12:00:00+00:00", "updatedAt":"2000-01-01T12:00:00+00:00", "deletedAt":"2000-01-01T12:00:00+00:00", "tenant": "95fecff7-b6c0-4a70-8896-b2f6f02da801" @@ -92,7 +94,6 @@ Feature: Edit categories And the response should be in JSON And the JSON node "id" should be equal to the number 1 And the JSON node "uuid" should be equal to the string "70f36469-a65c-4d81-ae15-d66a2ef90df0" - And the JSON node "createdAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "deletedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "tenant" should be equal to "b6ac25fe-3cd6-4100-a054-6bba2fc9ef18" @@ -105,7 +106,6 @@ Feature: Edit categories And the response should be in JSON And the JSON node "id" should be equal to the number 1 And the JSON node "uuid" should be equal to the string "70f36469-a65c-4d81-ae15-d66a2ef90df0" - And the JSON node "createdAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "deletedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "tenant" should be equal to "b6ac25fe-3cd6-4100-a054-6bba2fc9ef18" diff --git a/api/features/api/config/edit.feature b/api/features/api/config/edit.feature index 8813bb2c..ae3568eb 100644 --- a/api/features/api/config/edit.feature +++ b/api/features/api/config/edit.feature @@ -10,6 +10,7 @@ Feature: Edit configs And I send a "PUT" request to "/configs/4804b00d-cc69-4a2b-98c2-f8a0d9404764" with body: """ { + "createdAt": "2000-01-01 12:00:00", "value": "system2@system.ds", "version": 1 } @@ -17,6 +18,7 @@ Feature: Edit configs Then the response status code should be 200 And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "value" should be equal to the string "system2@system.ds" And the JSON node "version" should be equal to the number 2 @@ -26,6 +28,7 @@ Feature: Edit configs Then the response status code should be 200 And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "value" should be equal to the string "system2@system.ds" And the JSON node "version" should be equal to the number 2 @@ -37,7 +40,6 @@ Feature: Edit configs { "id": 9999, "uuid": "1ac1b01e-4934-4b89-8a43-7d17a849be61", - "createdAt":"2000-01-01T12:00:00+00:00", "updatedAt":"2000-01-01T12:00:00+00:00", "owner": "System", "ownerUuid": "5f8630dd-4739-4573-bcf6-9133416e4311", @@ -51,7 +53,6 @@ Feature: Edit configs And the response should be in JSON And the JSON node "id" should be equal to the number 1 And the JSON node "uuid" should be equal to the string "4804b00d-cc69-4a2b-98c2-f8a0d9404764" - And the JSON node "createdAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "owner" should be equal to "BusinessUnit" And the JSON node "ownerUuid" should be equal to "325e1004-8516-4ca9-a4d3-d7505bd9a7fe" @@ -66,7 +67,6 @@ Feature: Edit configs And the response should be in JSON And the JSON node "id" should be equal to the number 1 And the JSON node "uuid" should be equal to the string "4804b00d-cc69-4a2b-98c2-f8a0d9404764" - And the JSON node "createdAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "owner" should be equal to "BusinessUnit" And the JSON node "ownerUuid" should be equal to "325e1004-8516-4ca9-a4d3-d7505bd9a7fe" diff --git a/api/features/api/metadata/add.feature b/api/features/api/metadata/add.feature index b5fc8577..f67bf2c8 100644 --- a/api/features/api/metadata/add.feature +++ b/api/features/api/metadata/add.feature @@ -10,6 +10,7 @@ Feature: Add metadata And I send a "POST" request to "/metadata" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "BusinessUnit", "ownerUuid": "325e1004-8516-4ca9-a4d3-d7505bd9a7fe", "title": { @@ -31,6 +32,7 @@ Feature: Add metadata And the JSON node "id" should be equal to the number 3 And the JSON node "uuid" should exist And the JSON node "createdAt" should exist + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should exist And the JSON node "deletedAt" should exist And the JSON node "owner" should exist diff --git a/api/features/api/metadata/edit.feature b/api/features/api/metadata/edit.feature index 5c3a034e..3b3e9be8 100644 --- a/api/features/api/metadata/edit.feature +++ b/api/features/api/metadata/edit.feature @@ -10,6 +10,7 @@ Feature: Edit metadata And I send a "PUT" request to "/metadata/abe3bd7f-b0d4-4b77-97fa-f188a5b500a4" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "System", "ownerUuid": "aa18b644-a503-49fa-8f53-10f4c1f8e3a1", "title": { @@ -27,6 +28,7 @@ Feature: Edit metadata Then the response status code should be 200 And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "owner" should be equal to the string "System" And the JSON node "ownerUuid" should be equal to the string "aa18b644-a503-49fa-8f53-10f4c1f8e3a1" And the JSON node "title.en" should be equal to the string "Title - edit" @@ -42,6 +44,7 @@ Feature: Edit metadata Then the response status code should be 200 And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "owner" should be equal to the string "System" And the JSON node "ownerUuid" should be equal to the string "aa18b644-a503-49fa-8f53-10f4c1f8e3a1" And the JSON node "title.en" should be equal to the string "Title - edit" @@ -59,7 +62,6 @@ Feature: Edit metadata { "id": 9999, "uuid": "421aebbb-e62e-4b87-bced-42921456131b", - "createdAt":"2000-01-01T12:00:00+00:00", "updatedAt":"2000-01-01T12:00:00+00:00", "version": 2, "tenant": "93377748-2abb-4e33-9027-5d8a5c281a41" @@ -70,7 +72,6 @@ Feature: Edit metadata And the response should be in JSON And the JSON node "id" should be equal to the number 1 And the JSON node "uuid" should be equal to the string "abe3bd7f-b0d4-4b77-97fa-f188a5b500a4" - And the JSON node "createdAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "tenant" should be equal to "b6ac25fe-3cd6-4100-a054-6bba2fc9ef18" @@ -82,7 +83,6 @@ Feature: Edit metadata And the response should be in JSON And the JSON node "id" should be equal to the number 1 And the JSON node "uuid" should be equal to the string "abe3bd7f-b0d4-4b77-97fa-f188a5b500a4" - And the JSON node "createdAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "tenant" should be equal to "b6ac25fe-3cd6-4100-a054-6bba2fc9ef18" diff --git a/api/features/api/scenario/add.feature b/api/features/api/scenario/add.feature index 1d5503aa..ddc971a0 100644 --- a/api/features/api/scenario/add.feature +++ b/api/features/api/scenario/add.feature @@ -10,6 +10,7 @@ Feature: Add scenarios And I send a "POST" request to "/scenarios" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "BusinessUnit", "ownerUuid": "83bf8f26-7181-4bed-92f3-3ce5e4c286d7", "service": "/services/7293e6d1-48e2-4761-b9c6-f77258cbe31a", @@ -51,6 +52,7 @@ Feature: Add scenarios And the JSON node "id" should be equal to the number 3 And the JSON node "uuid" should exist And the JSON node "createdAt" should exist + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should exist And the JSON node "deletedAt" should exist And the JSON node "deletedAt" should be null diff --git a/api/features/api/scenario/edit.feature b/api/features/api/scenario/edit.feature index b5c9035e..b95bc852 100644 --- a/api/features/api/scenario/edit.feature +++ b/api/features/api/scenario/edit.feature @@ -10,6 +10,7 @@ Feature: Edit scenarios And I send a "PUT" request to "/scenarios/2cb7402d-2a1d-49b3-af2a-3cf378193ffa" with body: """ { + "createdAt": "2000-01-01 12:00:00", "ownerUuid": "325e1004-8516-4ca9-a4d3-d7505bd9a7fe", "slug": "online-edit", "title": { @@ -39,6 +40,7 @@ Feature: Edit scenarios Then the response status code should be 200 And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "ownerUuid" should be equal to the string "325e1004-8516-4ca9-a4d3-d7505bd9a7fe" And the JSON node "slug" should be equal to the string "online-edit" And the JSON node "title.en" should be equal to "Report a Pothole Online - edit" @@ -59,6 +61,7 @@ Feature: Edit scenarios Then the response status code should be 200 And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "ownerUuid" should be equal to the string "325e1004-8516-4ca9-a4d3-d7505bd9a7fe" And the JSON node "slug" should be equal to the string "online-edit" And the JSON node "title.en" should be equal to "Report a Pothole Online - edit" @@ -81,7 +84,6 @@ Feature: Edit scenarios { "id": 9999, "uuid": "002a4b0e-6f73-408f-8b04-3295a758feff", - "createdAt":"2000-01-01T12:00:00+00:00", "updatedAt":"2000-01-01T12:00:00+00:00", "deletedAt":"2000-01-01T12:00:00+00:00", "tenant": "20401625-f398-467b-ad31-955575f22d1e" @@ -92,7 +94,6 @@ Feature: Edit scenarios And the response should be in JSON And the JSON node "id" should be equal to the number 1 And the JSON node "uuid" should be equal to the string "2cb7402d-2a1d-49b3-af2a-3cf378193ffa" - And the JSON node "createdAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "deletedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "tenant" should be equal to "b6ac25fe-3cd6-4100-a054-6bba2fc9ef18" @@ -105,7 +106,6 @@ Feature: Edit scenarios And the response should be in JSON And the JSON node "id" should be equal to the number 1 And the JSON node "uuid" should be equal to the string "2cb7402d-2a1d-49b3-af2a-3cf378193ffa" - And the JSON node "createdAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "deletedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "tenant" should be equal to "b6ac25fe-3cd6-4100-a054-6bba2fc9ef18" diff --git a/api/features/api/service/add.feature b/api/features/api/service/add.feature index 5d9ff4ae..f9a68cbb 100644 --- a/api/features/api/service/add.feature +++ b/api/features/api/service/add.feature @@ -10,6 +10,7 @@ Feature: Add services And I send a "POST" request to "/services" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "BusinessUnit", "ownerUuid": "83bf8f26-7181-4bed-92f3-3ce5e4c286d7", "slug": "slug-add", @@ -45,6 +46,7 @@ Feature: Add services And the JSON node "id" should be equal to the number 7 And the JSON node "uuid" should exist And the JSON node "createdAt" should exist + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should exist And the JSON node "deletedAt" should exist And the JSON node "deletedAt" should be null diff --git a/api/features/api/service/edit.feature b/api/features/api/service/edit.feature index c5de0c96..60ca505c 100644 --- a/api/features/api/service/edit.feature +++ b/api/features/api/service/edit.feature @@ -10,6 +10,7 @@ Feature: Edit services And I send a "PUT" request to "/services/7293e6d1-48e2-4761-b9c6-f77258cbe31a" with body: """ { + "createdAt": "2000-01-01 12:00:00", "ownerUuid": "325e1004-8516-4ca9-a4d3-d7505bd9a7fe", "slug": "report-pothole-edit", "title": { @@ -39,6 +40,7 @@ Feature: Edit services Then the response status code should be 200 And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "ownerUuid" should be equal to the string "325e1004-8516-4ca9-a4d3-d7505bd9a7fe" And the JSON node "slug" should be equal to the string "report-pothole-edit" And the JSON node "title.en" should be equal to "Report a Pothole - edit" @@ -59,6 +61,7 @@ Feature: Edit services Then the response status code should be 200 And the header "Content-Type" should be equal to "application/json; charset=utf-8" And the response should be in JSON + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "ownerUuid" should be equal to the string "325e1004-8516-4ca9-a4d3-d7505bd9a7fe" And the JSON node "slug" should be equal to the string "report-pothole-edit" And the JSON node "title.en" should be equal to "Report a Pothole - edit" @@ -81,7 +84,6 @@ Feature: Edit services { "id": 9999, "uuid": "002a4b0e-6f73-408f-8b04-3295a758feff", - "createdAt":"2000-01-01T12:00:00+00:00", "updatedAt":"2000-01-01T12:00:00+00:00", "deletedAt":"2000-01-01T12:00:00+00:00", "tenant": "20401625-f398-467b-ad31-955575f22d1e" @@ -92,7 +94,6 @@ Feature: Edit services And the response should be in JSON And the JSON node "id" should be equal to the number 1 And the JSON node "uuid" should be equal to the string "7293e6d1-48e2-4761-b9c6-f77258cbe31a" - And the JSON node "createdAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "deletedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "tenant" should be equal to "b6ac25fe-3cd6-4100-a054-6bba2fc9ef18" @@ -105,7 +106,6 @@ Feature: Edit services And the response should be in JSON And the JSON node "id" should be equal to the number 1 And the JSON node "uuid" should be equal to the string "7293e6d1-48e2-4761-b9c6-f77258cbe31a" - And the JSON node "createdAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "deletedAt" should not contain "2000-01-01T12:00:00+00:00" And the JSON node "tenant" should be equal to "b6ac25fe-3cd6-4100-a054-6bba2fc9ef18" diff --git a/api/src/Entity/Category.php b/api/src/Entity/Category.php index 504ed153..d4ed5221 100644 --- a/api/src/Entity/Category.php +++ b/api/src/Entity/Category.php @@ -101,8 +101,9 @@ class Category implements Identifiable, Uuidentifiable, Sluggable, Ownable, Tran /** * @var \DateTime - * @ApiProperty(writable=false) - * @Serializer\Groups({"category_output"}) + * @ApiProperty + * @Serializer\Groups({"category_output", "category_input"}) + * @Assert\DateTime */ protected $createdAt; diff --git a/api/src/Entity/Scenario.php b/api/src/Entity/Scenario.php index 60c44847..8a535211 100644 --- a/api/src/Entity/Scenario.php +++ b/api/src/Entity/Scenario.php @@ -116,8 +116,9 @@ class Scenario implements Identifiable, Uuidentifiable, Sluggable, Ownable, Tran /** * @var \DateTime - * @ApiProperty(writable=false) - * @Serializer\Groups({"scenario_output"}) + * @ApiProperty + * @Serializer\Groups({"scenario_output", "scenario_input"}) + * @Assert\DateTime */ protected $createdAt; diff --git a/api/src/Entity/Service.php b/api/src/Entity/Service.php index b4b910f6..71770bd0 100644 --- a/api/src/Entity/Service.php +++ b/api/src/Entity/Service.php @@ -103,8 +103,9 @@ class Service implements Identifiable, Uuidentifiable, Sluggable, Ownable, Trans /** * @var \DateTime - * @ApiProperty(writable=false) - * @Serializer\Groups({"service_output"}) + * @ApiProperty + * @Serializer\Groups({"service_output", "service_input"}) + * @Assert\DateTime */ protected $createdAt; diff --git a/api/src/Entity/Submission.php b/api/src/Entity/Submission.php index c2ff6c48..13397039 100644 --- a/api/src/Entity/Submission.php +++ b/api/src/Entity/Submission.php @@ -91,8 +91,9 @@ class Submission implements Identifiable, Uuidentifiable, Ownable, Identitiable, /** * @var \DateTime - * @ApiProperty(writable=false) - * @Serializer\Groups({"submission_output"}) + * @ApiProperty + * @Serializer\Groups({"submission_output", "submission_input"}) + * @Assert\DateTime */ protected $createdAt; diff --git a/api/src/Fixture/Category.php b/api/src/Fixture/Category.php index b03dee88..d0c0ac8c 100644 --- a/api/src/Fixture/Category.php +++ b/api/src/Fixture/Category.php @@ -4,6 +4,7 @@ use App\Entity\Category as CategoryEntity; use App\Entity\Service; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; @@ -41,6 +42,12 @@ public function load(ObjectManager $manager) ->setWeight($object->weight) ->setTenant($object->tenant); + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $category->setCreatedAt($date); + } + foreach ($object->services as $uuid) { $service = $manager->getRepository(Service::class)->findOneBy(['uuid' => $uuid]); $category->addService($service); diff --git a/api/src/Fixture/Scenario.php b/api/src/Fixture/Scenario.php index 8ee57a9f..c7982148 100644 --- a/api/src/Fixture/Scenario.php +++ b/api/src/Fixture/Scenario.php @@ -4,6 +4,7 @@ use App\Entity\Service; use App\Entity\Scenario as ScenarioEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; @@ -44,6 +45,13 @@ public function load(ObjectManager $manager) ->setEnabled($object->enabled) ->setWeight($object->weight) ->setTenant($object->tenant); + + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $scenario->setCreatedAt($date); + } + $manager->persist($scenario); } diff --git a/api/src/Fixture/Service.php b/api/src/Fixture/Service.php index 41e72a89..f1dbd170 100644 --- a/api/src/Fixture/Service.php +++ b/api/src/Fixture/Service.php @@ -3,6 +3,7 @@ namespace App\Fixture; use App\Entity\Service as ServiceEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; @@ -39,6 +40,13 @@ public function load(ObjectManager $manager) ->setEnabled($object->enabled) ->setWeight($object->weight) ->setTenant($object->tenant); + + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $service->setCreatedAt($date); + } + $manager->persist($service); } From c2bfc620308955031a0961b103c7d86656047581 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 30 Aug 2020 15:21:48 -0400 Subject: [PATCH 11/17] Enable write on entity created_at properties --- api/features/api/system/tenant/add.feature | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/features/api/system/tenant/add.feature b/api/features/api/system/tenant/add.feature index 2c4f93cb..40c88b2c 100644 --- a/api/features/api/system/tenant/add.feature +++ b/api/features/api/system/tenant/add.feature @@ -10,6 +10,7 @@ Feature: Add tenant And I send a "POST" request to "/system/tenants" with body: """ { + "createdAt": "2000-01-01 12:00:00", "uuid": "3b0f1019-e9b6-458d-b9ad-fd60c079ee7b", "data": { "user": { @@ -70,6 +71,7 @@ Feature: Add tenant And the JSON node "uuid" should exist And the JSON node "uuid" should be equal to "3b0f1019-e9b6-458d-b9ad-fd60c079ee7b" And the JSON node "createdAt" should exist + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should exist And the JSON node "version" should exist And the JSON node "version" should be equal to the number 1 From 55e1f3f632dad5e6d25c3de46657f1efd0558291 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Mon, 31 Aug 2020 06:42:57 -0400 Subject: [PATCH 12/17] Fix var directory permissions --- api/docker/php/docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/docker/php/docker-entrypoint.sh b/api/docker/php/docker-entrypoint.sh index bf12dced..95668d25 100644 --- a/api/docker/php/docker-entrypoint.sh +++ b/api/docker/php/docker-entrypoint.sh @@ -8,8 +8,8 @@ fi if [ "$1" = 'php-fpm' ] || [ "$1" = 'bin/console' ]; then mkdir -p var/cache var/log -# setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX var -# setfacl -dR -m u:www-data:rwX -m u:"$(whoami)":rwX var + setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX var + setfacl -dR -m u:www-data:rwX -m u:"$(whoami)":rwX var if [ "$APP_ENV" != 'prod' ]; then composer install --prefer-dist --no-progress --no-suggest --no-interaction From 8708674a4589987a4ac77ff290e3068420d2233f Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sat, 12 Sep 2020 08:56:47 -0400 Subject: [PATCH 13/17] Add graffiti form scenario --- .../dev/workflow/bpmn/graffiti-report.bpmn | 49 +++++++++++++++++++ .../fixtures/dev/workflow/deployment.yaml | 4 ++ 2 files changed, 53 insertions(+) create mode 100644 api/config/fixtures/dev/workflow/bpmn/graffiti-report.bpmn diff --git a/api/config/fixtures/dev/workflow/bpmn/graffiti-report.bpmn b/api/config/fixtures/dev/workflow/bpmn/graffiti-report.bpmn new file mode 100644 index 00000000..e2621126 --- /dev/null +++ b/api/config/fixtures/dev/workflow/bpmn/graffiti-report.bpmn @@ -0,0 +1,49 @@ + + + + + SequenceFlow_1q8gf6i + + + + SequenceFlow_1q8gf6i + SequenceFlow_0wplinc + + + SequenceFlow_0wplinc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/api/config/fixtures/dev/workflow/deployment.yaml b/api/config/fixtures/dev/workflow/deployment.yaml index ad7dc56c..9bcd6f21 100644 --- a/api/config/fixtures/dev/workflow/deployment.yaml +++ b/api/config/fixtures/dev/workflow/deployment.yaml @@ -3,6 +3,10 @@ objects: files: - bpmn/pothole-report.bpmn + - name: Graffiti Report + files: + - bpmn/graffiti-report.bpmn + prototype: name: ~ source: ~ From a9417e20608023a914401b6270761a6a2332c2ba Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Wed, 16 Sep 2020 19:44:27 -0400 Subject: [PATCH 14/17] Update composer dependencies --- api/composer.json | 1 + api/composer.lock | 145 +++++++++++++++++++++++----------------------- 2 files changed, 74 insertions(+), 72 deletions(-) diff --git a/api/composer.json b/api/composer.json index f947077d..9b920fe8 100644 --- a/api/composer.json +++ b/api/composer.json @@ -15,6 +15,7 @@ "doctrine/doctrine-fixtures-bundle": "^3.0", "doctrine/doctrine-migrations-bundle": "^1.3", "guzzlehttp/guzzle": "^6.3", + "justinrainbow/json-schema": "^5.0", "knplabs/doctrine-behaviors": "^1.5", "lexik/jwt-authentication-bundle": "^2.6", "ramsey/uuid": "^3.8", diff --git a/api/composer.lock b/api/composer.lock index 21cf89f2..6f8805b8 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a2551c8ae8a510b728b0b7f4a7720eb9", + "content-hash": "831670e819cf6fdd1ddf6ebaa837731b", "packages": [ { "name": "api-platform/api-pack", @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "c762a4f7a9ed1815742564d7890f8652d65dc3d0" + "reference": "ddd320c3aacb7c5e7bdb962b5d2715abcb1dd9d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/c762a4f7a9ed1815742564d7890f8652d65dc3d0", - "reference": "c762a4f7a9ed1815742564d7890f8652d65dc3d0", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/ddd320c3aacb7c5e7bdb962b5d2715abcb1dd9d2", + "reference": "ddd320c3aacb7c5e7bdb962b5d2715abcb1dd9d2", "shasum": "" }, "require": { @@ -1947,6 +1947,72 @@ ], "time": "2014-01-12T16:20:24+00:00" }, + { + "name": "justinrainbow/json-schema", + "version": "5.2.10", + "source": { + "type": "git", + "url": "https://github.com/justinrainbow/json-schema.git", + "reference": "2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b", + "reference": "2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", + "json-schema/json-schema-test-suite": "1.2.0", + "phpunit/phpunit": "^4.8.35" + }, + "bin": [ + "bin/validate-json" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "JsonSchema\\": "src/JsonSchema/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bruno Prieto Reis", + "email": "bruno.p.reis@gmail.com" + }, + { + "name": "Justin Rainbow", + "email": "justin.rainbow@gmail.com" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, + { + "name": "Robert Schönthal", + "email": "seroscho@googlemail.com" + } + ], + "description": "A library to validate a json schema.", + "homepage": "https://github.com/justinrainbow/json-schema", + "keywords": [ + "json", + "schema" + ], + "time": "2020-05-27T16:41:55+00:00" + }, { "name": "knplabs/doctrine-behaviors", "version": "1.6.0", @@ -7000,6 +7066,7 @@ ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", "homepage": "https://github.com/container-interop/container-interop", + "abandoned": "psr/container", "time": "2017-02-14T19:40:03+00:00" }, { @@ -7007,12 +7074,12 @@ "version": "0.9.1", "source": { "type": "git", - "url": "https://github.com/njh/easyrdf.git", + "url": "https://github.com/easyrdf/easyrdf.git", "reference": "acd09dfe0555fbcfa254291e433c45fdd4652566" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/njh/easyrdf/zipball/acd09dfe0555fbcfa254291e433c45fdd4652566", + "url": "https://api.github.com/repos/easyrdf/easyrdf/zipball/acd09dfe0555fbcfa254291e433c45fdd4652566", "reference": "acd09dfe0555fbcfa254291e433c45fdd4652566", "shasum": "" }, @@ -7160,72 +7227,6 @@ "description": "A tool to automatically fix PHP code style", "time": "2019-01-04T18:29:47+00:00" }, - { - "name": "justinrainbow/json-schema", - "version": "5.2.8", - "source": { - "type": "git", - "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/dcb6e1006bb5fd1e392b4daa68932880f37550d4", - "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~2.2.20", - "json-schema/json-schema-test-suite": "1.2.0", - "phpunit/phpunit": "^4.8.35" - }, - "bin": [ - "bin/validate-json" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "JsonSchema\\": "src/JsonSchema/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bruno Prieto Reis", - "email": "bruno.p.reis@gmail.com" - }, - { - "name": "Justin Rainbow", - "email": "justin.rainbow@gmail.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - }, - { - "name": "Robert Schönthal", - "email": "seroscho@googlemail.com" - } - ], - "description": "A library to validate a json schema.", - "homepage": "https://github.com/justinrainbow/json-schema", - "keywords": [ - "json", - "schema" - ], - "time": "2019-01-14T23:55:14+00:00" - }, { "name": "league/html-to-markdown", "version": "4.8.1", From 6fef8e946913a008d00729b606f2f7ef96e3eda3 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Wed, 21 Oct 2020 18:26:00 -0400 Subject: [PATCH 15/17] Return submission entity when posting to controller --- .../Scenario/SubmissionsController.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/api/src/Controller/Scenario/SubmissionsController.php b/api/src/Controller/Scenario/SubmissionsController.php index fcc9b015..b0b9cece 100644 --- a/api/src/Controller/Scenario/SubmissionsController.php +++ b/api/src/Controller/Scenario/SubmissionsController.php @@ -7,11 +7,11 @@ use App\Service\ScenarioService; use App\Service\SubmissionService; use InvalidArgumentException; -use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\Serializer\SerializerInterface; use Symfony\Component\Validator\ConstraintViolationList; use function GuzzleHttp\json_decode; @@ -37,18 +37,25 @@ final class SubmissionsController */ private $submissionService; + /** + * @var \Symfony\Component\Serializer\SerializerInterface + */ + private $serializer; + /** * Constructor * * @param \Symfony\Component\HttpFoundation\RequestStack $requestStack * @param \App\Service\ScenarioService $scenarioService * @param \App\Service\SubmissionService $submissionService + * @param \Symfony\Component\Serializer\SerializerInterface $serializer */ - public function __construct(RequestStack $requestStack, ScenarioService $scenarioService, SubmissionService $submissionService) + public function __construct(RequestStack $requestStack, ScenarioService $scenarioService, SubmissionService $submissionService, SerializerInterface $serializer) { $this->requestStack = $requestStack; $this->scenarioService = $scenarioService; $this->submissionService = $submissionService; + $this->serializer = $serializer; } /** @@ -56,7 +63,7 @@ public function __construct(RequestStack $requestStack, ScenarioService $scenari * * @Route(path="/scenarios/{uuid}/submissions", methods={"POST"}) * @param string $uuid - * @return \Symfony\Component\HttpFoundation\JsonResponse + * @return \Symfony\Component\HttpFoundation\Response * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public function post($uuid) @@ -90,7 +97,11 @@ public function post($uuid) $manager = $this->submissionService->getManager(); $manager->persist($submission); $manager->flush(); - $response = new JsonResponse($submission, Response::HTTP_CREATED); + $response = new Response( + $this->serializer->serialize($submission, 'json', ['item_operation_name' => 'get']), + Response::HTTP_CREATED, + ['Content-Type' => 'application/json'] + ); return $response; } From f158d04307ac20d7481e2a5bc4601c799b74735c Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sat, 31 Oct 2020 17:01:37 -0400 Subject: [PATCH 16/17] Set composer version in dockerfile --- api/Dockerfile-php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/Dockerfile-php b/api/Dockerfile-php index e316e63a..18474adc 100644 --- a/api/Dockerfile-php +++ b/api/Dockerfile-php @@ -46,7 +46,7 @@ RUN set -eux; \ \ apk del .build-deps -COPY --from=composer:latest /usr/bin/composer /usr/bin/composer +COPY --from=composer:1.10.16 /usr/bin/composer /usr/bin/composer COPY docker/php/php.ini /usr/local/etc/php/php.ini # https://getcomposer.org/doc/03-cli.md#composer-allow-superuser From b69d3129e3c54c5b88c02985e7c34b5224e707d2 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Tue, 2 Feb 2021 19:13:52 -0500 Subject: [PATCH 17/17] Remove deprecated dependency checker service --- .travis.yml | 1 - api/composer.json | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5b9cc6a5..4fce1a74 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,6 @@ before_install: script: - docker-compose -f docker-compose.yml -f docker-compose.test.yml up -d - while true; do output=`docker-compose exec -T php pidof php-fpm | cat`; if [[ ! -z "${output}" ]]; then break; fi; sleep 1; done; - - docker-compose -f docker-compose.yml -f docker-compose.test.yml exec php php bin/console security:check - docker-compose -f docker-compose.yml -f docker-compose.test.yml exec php php bin/console doctrine:migration:migrate --no-interaction - docker-compose -f docker-compose.yml -f docker-compose.test.yml exec -e FIXTURES=test php php bin/console doctrine:fixtures:load --no-interaction - docker-compose -f docker-compose.yml -f docker-compose.test.yml exec php vendor/bin/behat diff --git a/api/composer.json b/api/composer.json index 9b920fe8..c17e6820 100644 --- a/api/composer.json +++ b/api/composer.json @@ -68,8 +68,7 @@ "auto-scripts": { "cache:clear": "symfony-cmd", "assets:install": "symfony-cmd", - "assets:install %PUBLIC_DIR%": "symfony-cmd", - "security-checker security:check": "script" + "assets:install %PUBLIC_DIR%": "symfony-cmd" }, "post-install-cmd": [ "@auto-scripts"