From 9c0bdd7315d6ca74deeeef39576358ffa73835ed Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Thu, 30 Jul 2020 14:59:41 -0400 Subject: [PATCH 01/27] 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/src/Migration/Version0_19_0.php | 50 +++++++++++++ api/symfony.lock | 3 + 6 files changed, 134 insertions(+), 5 deletions(-) create mode 100644 api/src/Migration/Version0_19_0.php diff --git a/api/composer.json b/api/composer.json index 8bc2429..ab61ba2 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 bed2359..3805c8e 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": "06790df6deed2a61886c886c34c424a6", + "content-hash": "23f583548c8239e0cc1928954e0ff26b", "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 a74c923..5caefe0 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 02aef9d..4ede26b 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/src/Migration/Version0_19_0.php b/api/src/Migration/Version0_19_0.php new file mode 100644 index 0000000..0f3121f --- /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 e08f1ac..67f9a30 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 8f7ba41edb97db3ad084872bf9ae7a4ed6bec17e Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Thu, 30 Jul 2020 15:34:25 -0400 Subject: [PATCH 02/27] 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 818f23f..f06e79f 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: Microservice - version: 0.18.1 + version: 0.19.0 collection: pagination: page_parameter_name: _page From e4934b7902513625f405934a7580368c82a0d550 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Thu, 30 Jul 2020 15:48:43 -0400 Subject: [PATCH 03/27] 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 0dfcb71..cdb48b1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,7 @@ services: - microservice_database php: - image: digitalstate/microservice:php-0.18.1 + image: digitalstate/microservice:php-0.19.0 depends_on: - database env_file: @@ -44,7 +44,7 @@ services: - microservice_php api: - image: digitalstate/microservice:api-0.18.1 + image: digitalstate/microservice:api-0.19.0 depends_on: - php networks: From 876eda9b00b78b39fed80759b11a77a22f60fffe Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 2 Aug 2020 07:12:29 -0400 Subject: [PATCH 04/27] 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 ab61ba2..0ba5d91 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 3805c8e..03a1319 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 420a98dd89b52cee62913f8b274daab8becd08a8 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 2 Aug 2020 07:57:17 -0400 Subject: [PATCH 05/27] 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 03a1319..917b811 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 ed0c302743c6062ee23c62c0d8d4c20552609a86 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Mon, 3 Aug 2020 16:40:21 -0400 Subject: [PATCH 06/27] 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 917b811..779e082 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 580783eb5c3c53b268f665a1f1e1d69faacccae3 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Wed, 5 Aug 2020 18:54:51 -0400 Subject: [PATCH 07/27] 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 779e082..274f752 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 acc6bb2a3da79a5a9e5bfb9acc6bb4a0a8a0646a Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Thu, 6 Aug 2020 17:42:19 -0400 Subject: [PATCH 08/27] 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 274f752..2dca5b1 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 c49ff94ca0915c38a53ab761fd84e32d62a43656 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 9 Aug 2020 08:37:29 -0400 Subject: [PATCH 09/27] Update behat tests --- api/config/fixtures/test/config.yaml | 48 +++++++++++++++++++ .../fixtures/test/system/parameter.yaml | 9 ++++ api/config/fixtures/test/system/tenant.yaml | 2 + 3 files changed, 59 insertions(+) diff --git a/api/config/fixtures/test/config.yaml b/api/config/fixtures/test/config.yaml index 7c90d3b..e563439 100644 --- a/api/config/fixtures/test/config.yaml +++ b/api/config/fixtures/test/config.yaml @@ -1,4 +1,52 @@ objects: + - uuid: b678a6cd-7b84-4495-9ac6-51c41c4320f6 + owner_uuid: ~ + key: ds_api.user.username + value: system@system.ds + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: dc31a45a-10b0-41d0-8656-ccb7c7fe9cd8 + owner_uuid: ~ + key: ds_api.user.password + value: system + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 319ca96f-660f-4649-8f57-feee719ea139 + owner_uuid: ~ + key: ds_api.user.uuid + value: ~ + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 2fd73e7e-1e93-4a8c-8b6d-d13fba8b1cc7 + owner_uuid: ~ + key: ds_api.user.roles + value: [] + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 5f949862-7f21-47af-b676-b094dfe11e7a + owner_uuid: ~ + key: ds_api.user.identity.roles + value: [] + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 37b9bb65-798b-4b07-a524-d3b98e12809e + owner_uuid: ~ + key: ds_api.user.identity.type + value: System + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 206b0b3d-f21b-4137-b31c-903fa27a9860 + owner_uuid: ~ + key: ds_api.user.identity.uuid + value: ~ + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 43372ccd-0ee8-4652-af6c-d39443548084 + owner_uuid: ~ + key: ds_api.user.tenant + value: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + - uuid: b678a6cd-7b84-4495-9ac6-51c41c4320f6 owner_uuid: 325e1004-8516-4ca9-a4d3-d7505bd9a7fe # Administration key: ds_api.user.username diff --git a/api/config/fixtures/test/system/parameter.yaml b/api/config/fixtures/test/system/parameter.yaml index e43b570..ed92771 100644 --- a/api/config/fixtures/test/system/parameter.yaml +++ b/api/config/fixtures/test/system/parameter.yaml @@ -5,6 +5,15 @@ objects: - key: ds_system.user.password value: system + - key: ds_tenant.tenant.default + value: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - key: ds_system.user.username + value: system + + - key: ds_system.user.password + value: system + - key: ds_tenant.tenant.default value: b6ac25fe-3cd6-4100-a054-6bba2fc9ef18 # Tenant 1 diff --git a/api/config/fixtures/test/system/tenant.yaml b/api/config/fixtures/test/system/tenant.yaml index 748d82c..1673625 100644 --- a/api/config/fixtures/test/system/tenant.yaml +++ b/api/config/fixtures/test/system/tenant.yaml @@ -1,4 +1,6 @@ objects: + - uuid: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + - uuid: b6ac25fe-3cd6-4100-a054-6bba2fc9ef18 # Tenant 1 - uuid: 92000deb-b847-4838-915c-b95d2b28e960 # Tenant 2 From b54b66226760ba4a2c0b10e8f3e7e08a7a6a7e17 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 9 Aug 2020 08:41:58 -0400 Subject: [PATCH 10/27] Update behat tests --- api/config/fixtures/test/config.yaml | 16 ++++++++-------- api/config/fixtures/test/system/parameter.yaml | 9 +++++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/api/config/fixtures/test/config.yaml b/api/config/fixtures/test/config.yaml index e563439..8d0a423 100644 --- a/api/config/fixtures/test/config.yaml +++ b/api/config/fixtures/test/config.yaml @@ -1,47 +1,47 @@ objects: - - uuid: b678a6cd-7b84-4495-9ac6-51c41c4320f6 + - uuid: d18730af-2ca1-4fab-883b-cc7f5636505e owner_uuid: ~ key: ds_api.user.username value: system@system.ds tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - uuid: dc31a45a-10b0-41d0-8656-ccb7c7fe9cd8 + - uuid: 4fb187d8-df64-44e4-a7ea-28f82d77553e owner_uuid: ~ key: ds_api.user.password value: system tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - uuid: 319ca96f-660f-4649-8f57-feee719ea139 + - uuid: 504e7e09-2b84-4199-8d95-5ae95e92f94b owner_uuid: ~ key: ds_api.user.uuid value: ~ tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - uuid: 2fd73e7e-1e93-4a8c-8b6d-d13fba8b1cc7 + - uuid: 779491cc-0543-47bd-98f2-698973ed8806 owner_uuid: ~ key: ds_api.user.roles value: [] tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - uuid: 5f949862-7f21-47af-b676-b094dfe11e7a + - uuid: 04249872-caeb-48ae-a575-6c0edc634458 owner_uuid: ~ key: ds_api.user.identity.roles value: [] tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - uuid: 37b9bb65-798b-4b07-a524-d3b98e12809e + - uuid: f46b94d4-53d2-46f3-a7ff-039a410fabbb owner_uuid: ~ key: ds_api.user.identity.type value: System tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - uuid: 206b0b3d-f21b-4137-b31c-903fa27a9860 + - uuid: d86b86e0-02bf-4881-90d4-7796de269b43 owner_uuid: ~ key: ds_api.user.identity.uuid value: ~ tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - uuid: 43372ccd-0ee8-4652-af6c-d39443548084 + - uuid: 884bfcb1-7dbb-47ef-97f6-d7d32eaf1b5b owner_uuid: ~ key: ds_api.user.tenant value: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 diff --git a/api/config/fixtures/test/system/parameter.yaml b/api/config/fixtures/test/system/parameter.yaml index ed92771..5c0544c 100644 --- a/api/config/fixtures/test/system/parameter.yaml +++ b/api/config/fixtures/test/system/parameter.yaml @@ -16,6 +16,15 @@ objects: - key: ds_tenant.tenant.default value: b6ac25fe-3cd6-4100-a054-6bba2fc9ef18 # Tenant 1 + + - key: ds_system.user.username + value: system + + - key: ds_system.user.password + value: system + + - key: ds_tenant.tenant.default + value: 92000deb-b847-4838-915c-b95d2b28e960 # Tenant 2 prototype: key: ~ From 7b3529643d7d647d5001926f1ada96b0dbd6ddc5 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 9 Aug 2020 08:48:35 -0400 Subject: [PATCH 11/27] Update behat tests --- api/config/fixtures/test/system/parameter.yaml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/api/config/fixtures/test/system/parameter.yaml b/api/config/fixtures/test/system/parameter.yaml index 5c0544c..e43b570 100644 --- a/api/config/fixtures/test/system/parameter.yaml +++ b/api/config/fixtures/test/system/parameter.yaml @@ -5,26 +5,8 @@ objects: - key: ds_system.user.password value: system - - key: ds_tenant.tenant.default - value: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - - key: ds_system.user.username - value: system - - - key: ds_system.user.password - value: system - - key: ds_tenant.tenant.default value: b6ac25fe-3cd6-4100-a054-6bba2fc9ef18 # Tenant 1 - - - key: ds_system.user.username - value: system - - - key: ds_system.user.password - value: system - - - key: ds_tenant.tenant.default - value: 92000deb-b847-4838-915c-b95d2b28e960 # Tenant 2 prototype: key: ~ From 2ba74c2007754391693e3f3237a0e84b87e5a1e8 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 9 Aug 2020 08:58:33 -0400 Subject: [PATCH 12/27] Update behat tests --- api/config/fixtures/test/config.yaml | 96 ++++++++++----------- api/config/fixtures/test/metadata.yaml | 75 ++++++++++++++++ api/config/fixtures/test/system/tenant.yaml | 4 +- 3 files changed, 125 insertions(+), 50 deletions(-) diff --git a/api/config/fixtures/test/config.yaml b/api/config/fixtures/test/config.yaml index 8d0a423..b7ef970 100644 --- a/api/config/fixtures/test/config.yaml +++ b/api/config/fixtures/test/config.yaml @@ -1,52 +1,4 @@ objects: - - uuid: d18730af-2ca1-4fab-883b-cc7f5636505e - owner_uuid: ~ - key: ds_api.user.username - value: system@system.ds - tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - - uuid: 4fb187d8-df64-44e4-a7ea-28f82d77553e - owner_uuid: ~ - key: ds_api.user.password - value: system - tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - - uuid: 504e7e09-2b84-4199-8d95-5ae95e92f94b - owner_uuid: ~ - key: ds_api.user.uuid - value: ~ - tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - - uuid: 779491cc-0543-47bd-98f2-698973ed8806 - owner_uuid: ~ - key: ds_api.user.roles - value: [] - tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - - uuid: 04249872-caeb-48ae-a575-6c0edc634458 - owner_uuid: ~ - key: ds_api.user.identity.roles - value: [] - tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - - uuid: f46b94d4-53d2-46f3-a7ff-039a410fabbb - owner_uuid: ~ - key: ds_api.user.identity.type - value: System - tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - - uuid: d86b86e0-02bf-4881-90d4-7796de269b43 - owner_uuid: ~ - key: ds_api.user.identity.uuid - value: ~ - tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - - uuid: 884bfcb1-7dbb-47ef-97f6-d7d32eaf1b5b - owner_uuid: ~ - key: ds_api.user.tenant - value: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - uuid: b678a6cd-7b84-4495-9ac6-51c41c4320f6 owner_uuid: 325e1004-8516-4ca9-a4d3-d7505bd9a7fe # Administration key: ds_api.user.username @@ -143,6 +95,54 @@ objects: value: 92000deb-b847-4838-915c-b95d2b28e960 # Tenant 2 tenant: 92000deb-b847-4838-915c-b95d2b28e960 # Tenant 2 + - uuid: d18730af-2ca1-4fab-883b-cc7f5636505e + owner_uuid: ~ + key: ds_api.user.username + value: system@system.ds + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 4fb187d8-df64-44e4-a7ea-28f82d77553e + owner_uuid: ~ + key: ds_api.user.password + value: system + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 504e7e09-2b84-4199-8d95-5ae95e92f94b + owner_uuid: ~ + key: ds_api.user.uuid + value: ~ + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 779491cc-0543-47bd-98f2-698973ed8806 + owner_uuid: ~ + key: ds_api.user.roles + value: [] + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 04249872-caeb-48ae-a575-6c0edc634458 + owner_uuid: ~ + key: ds_api.user.identity.roles + value: [] + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: f46b94d4-53d2-46f3-a7ff-039a410fabbb + owner_uuid: ~ + key: ds_api.user.identity.type + value: System + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: d86b86e0-02bf-4881-90d4-7796de269b43 + owner_uuid: ~ + key: ds_api.user.identity.uuid + value: ~ + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 884bfcb1-7dbb-47ef-97f6-d7d32eaf1b5b + owner_uuid: ~ + key: ds_api.user.tenant + value: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + 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 4231981..9318324 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: f94e886e-f73d-472d-82f7-0483372444d3 @@ -29,8 +30,82 @@ objects: identity: Identity owner: Owner session: Session + property: Property tenant: 92000deb-b847-4838-915c-b95d2b28e960 # Tenant 2 + - uuid: 6211c7bd-a680-40ff-89e0-4c98aba229db + owner: BusinessUnit + owner_uuid: ~ + title: + en: Metadata 1 + fr: Metadata 1 + slug: metadata-1 + type: metadata + data: + attribute: true + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: e816d4d3-76a1-4082-b99c-39c3e81cbb83 + owner: BusinessUnit + owner_uuid: ~ + title: + en: Metadata 2 + fr: Metadata 2 + slug: metadata-2 + type: metadata + data: + attribute: "string" + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: c95a4acb-259a-40cd-ac0b-a303e2d1c894 + owner: BusinessUnit + owner_uuid: ~ + title: + en: Metadata 3 + fr: Metadata 3 + slug: metadata-3 + type: metadata + data: + attribute: 123 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: a235421c-0502-4ff3-b152-9d58ba279f92 + owner: BusinessUnit + owner_uuid: ~ + title: + en: Metadata 4 + fr: Metadata 4 + slug: metadata-4 + type: metadata + data: + attribute: 1.23 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 8df80b6e-5f45-4e87-bd75-5f62ee86d4b0 + owner: BusinessUnit + owner_uuid: ~ + title: + en: Metadata 5 + fr: Metadata 5 + slug: metadata-5 + type: metadata + data: + attribute: [] + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 82f3e242-6d6f-4b22-bdee-bc8dcb698514 + owner: BusinessUnit + owner_uuid: ~ + title: + en: Metadata 6 + fr: Metadata 6 + slug: metadata-6 + type: metadata + data: + attribute: + subattribute: "string" + 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 1673625..7be4c9d 100644 --- a/api/config/fixtures/test/system/tenant.yaml +++ b/api/config/fixtures/test/system/tenant.yaml @@ -1,10 +1,10 @@ objects: - - uuid: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - uuid: b6ac25fe-3cd6-4100-a054-6bba2fc9ef18 # Tenant 1 - uuid: 92000deb-b847-4838-915c-b95d2b28e960 # Tenant 2 + - uuid: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + prototype: uuid: ~ data: {} From 13c6c9facc30def6d4d77b573a55fae7dda32cc6 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 9 Aug 2020 09:00:32 -0400 Subject: [PATCH 13/27] Update behat tests --- api/features/api/system/tenant/add.feature | 2 +- api/features/api/system/tenant/browse.feature | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/features/api/system/tenant/add.feature b/api/features/api/system/tenant/add.feature index ae37de8..34dd864 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 diff --git a/api/features/api/system/tenant/browse.feature b/api/features/api/system/tenant/browse.feature index 6e0b169..f339c34 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 3d30de7b2e1e7cd8363e5e3957663e1c593d5eca Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 9 Aug 2020 09:35:21 -0400 Subject: [PATCH 14/27] Update behat tests --- api/features/api/metadata/add.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/features/api/metadata/add.feature b/api/features/api/metadata/add.feature index b5fc857..4f418dd 100644 --- a/api/features/api/metadata/add.feature +++ b/api/features/api/metadata/add.feature @@ -28,7 +28,7 @@ Feature: Add metadata 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 9 And the JSON node "uuid" should exist And the JSON node "createdAt" should exist And the JSON node "updatedAt" should exist @@ -56,7 +56,7 @@ Feature: Add metadata Scenario: Read the added metadata When I add "Accept" header equal to "application/json" - And I send a "GET" request to "/metadata?id=3" + And I send a "GET" request to "/metadata?id=9" 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 From 0361849237fab458629fe0f32d6590a3abb6f445 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 9 Aug 2020 10:07:54 -0400 Subject: [PATCH 15/27] 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 2dca5b1..9f17b30 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": "0b52f28faed58825252d37917c2cbcde362093c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/ac3da6f8fd4e79933769f01253ab96d552b33776", - "reference": "ac3da6f8fd4e79933769f01253ab96d552b33776", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/0b52f28faed58825252d37917c2cbcde362093c8", + "reference": "0b52f28faed58825252d37917c2cbcde362093c8", "shasum": "" }, "require": { From a4799ff33a7f1836a49e33e7118dd1a5098e5460 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 9 Aug 2020 10:28:14 -0400 Subject: [PATCH 16/27] 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 9f17b30..4fe72e3 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "0b52f28faed58825252d37917c2cbcde362093c8" + "reference": "3598ccdb1f4275acf7c25fbceef0cd036e787f65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/0b52f28faed58825252d37917c2cbcde362093c8", - "reference": "0b52f28faed58825252d37917c2cbcde362093c8", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/3598ccdb1f4275acf7c25fbceef0cd036e787f65", + "reference": "3598ccdb1f4275acf7c25fbceef0cd036e787f65", "shasum": "" }, "require": { From f1a2e421de4ec1725d26f573825a11473050581f Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 9 Aug 2020 10:53:40 -0400 Subject: [PATCH 17/27] Update behat tests --- api/composer.lock | 6 ++--- .../fixtures/test/access/role/access.yaml | 25 ++++++++++++++++++- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/api/composer.lock b/api/composer.lock index 4fe72e3..40a7397 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "3598ccdb1f4275acf7c25fbceef0cd036e787f65" + "reference": "0a194ec84dce2b444cac5bc733fdc6ed4e4230ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/3598ccdb1f4275acf7c25fbceef0cd036e787f65", - "reference": "3598ccdb1f4275acf7c25fbceef0cd036e787f65", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/0a194ec84dce2b444cac5bc733fdc6ed4e4230ff", + "reference": "0a194ec84dce2b444cac5bc733fdc6ed4e4230ff", "shasum": "" }, "require": { diff --git a/api/config/fixtures/test/access/role/access.yaml b/api/config/fixtures/test/access/role/access.yaml index fb18ad2..356e7e3 100644 --- a/api/config/fixtures/test/access/role/access.yaml +++ b/api/config/fixtures/test/access/role/access.yaml @@ -1,4 +1,27 @@ -objects: [] +objects: + - uuid: f0897a2e-ed25-4937-bb50-f35e7c6ca520 + assignee_uuid: df0d6e00-3582-4ccc-92f8-0425ba35bb0a + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: e4ce3338-9ac8-480a-8eb9-ac1442ec654b + assignee_uuid: 359e49d3-2fd0-4a68-b5e2-99b74cd6a34c + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: d0339d5c-fea7-4ea8-b002-8a84fa57e3e9 + assignee_uuid: 9c8cb648-b6fe-4730-8d5d-d8ad0cbe9072 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: fca3ff59-ae91-48d4-b189-31d27093d405 + assignee_uuid: fd8a9110-f41e-46e9-8109-31db9e187f71 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: ea6ab451-6999-43c7-8f87-731dcdac72dd + assignee_uuid: c57e3d26-792b-492f-8095-b96bc83c8ba5 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 617e0602-40ea-4f94-b208-5ce1997c691f + assignee_uuid: 37a96b86-1610-492c-86b1-a57a2504d562 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 prototype: uuid: ~ From fb7fa66c60ebba7f1e0ebe5018fd2857b909ac83 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 9 Aug 2020 10:59:29 -0400 Subject: [PATCH 18/27] Update behat tests --- api/features/api/access/add.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/features/api/access/add.feature b/api/features/api/access/add.feature index fdae0d8..a856633 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 25 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=25" 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 From ce4b26f8086343aff486b9cad16fe77c456a1a23 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 9 Aug 2020 16:41:32 -0400 Subject: [PATCH 19/27] Update behat tests --- api/composer.lock | 6 +- .../fixtures/test/access/role/access.yaml | 20 ++ .../fixtures/test/access/role/permission.yaml | 187 ++++++++++- api/config/fixtures/test/metadata.yaml | 58 ++-- api/features/api/access/add.feature | 4 +- api/features/api/metadata/add.feature | 4 +- .../api/security/acl/metadata.feature | 312 ++++++++++++++++++ 7 files changed, 564 insertions(+), 27 deletions(-) create mode 100644 api/features/api/security/acl/metadata.feature diff --git a/api/composer.lock b/api/composer.lock index 40a7397..f9e26cc 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "0a194ec84dce2b444cac5bc733fdc6ed4e4230ff" + "reference": "3ac6aafc05e9f9493ae0d28c9d4a8a6a8a048b53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/0a194ec84dce2b444cac5bc733fdc6ed4e4230ff", - "reference": "0a194ec84dce2b444cac5bc733fdc6ed4e4230ff", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/3ac6aafc05e9f9493ae0d28c9d4a8a6a8a048b53", + "reference": "3ac6aafc05e9f9493ae0d28c9d4a8a6a8a048b53", "shasum": "" }, "require": { diff --git a/api/config/fixtures/test/access/role/access.yaml b/api/config/fixtures/test/access/role/access.yaml index 356e7e3..a23d485 100644 --- a/api/config/fixtures/test/access/role/access.yaml +++ b/api/config/fixtures/test/access/role/access.yaml @@ -23,6 +23,26 @@ objects: assignee_uuid: 37a96b86-1610-492c-86b1-a57a2504d562 tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + - uuid: 33a83ffe-1879-49f1-86b4-64c97d178dfe + assignee_uuid: 7f4a80e0-8720-40af-b424-f4c827c17987 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 77b4306e-feb7-4f4d-9fa6-de1bfd073eed + assignee_uuid: 72e33a99-d9c1-41d3-b2b6-c360ba03b016 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: b88188c1-5014-4e97-b321-757d0ffd0f24 + assignee_uuid: e37f9cea-2f85-46e8-ad02-96bc0f4ce24a + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: ed65bd97-1170-4f7e-b1dc-1307ac70e555 + assignee_uuid: fd71f9c1-45d0-4108-b1ec-fba860ad5808 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 1a9a98f2-4d88-45ca-8b55-18e6e8915252 + assignee_uuid: 30328696-956f-4f5c-bc65-f0312a5c7d63 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + prototype: uuid: ~ owner: BusinessUnit diff --git a/api/config/fixtures/test/access/role/permission.yaml b/api/config/fixtures/test/access/role/permission.yaml index a50e99b..2ecafb3 100644 --- a/api/config/fixtures/test/access/role/permission.yaml +++ b/api/config/fixtures/test/access/role/permission.yaml @@ -1,4 +1,189 @@ -objects: [] +objects: + - access: f0897a2e-ed25-4937-bb50-f35e7c6ca520 + key: entity + attributes: [BROWSE, READ, EDIT, ADD, DELETE] + scope: + type: owner + entity: BusinessUnit + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: f0897a2e-ed25-4937-bb50-f35e7c6ca520 + key: property + attributes: [BROWSE, READ, EDIT] + scope: + type: owner + entity: BusinessUnit + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: e4ce3338-9ac8-480a-8eb9-ac1442ec654b + key: entity + attributes: [BROWSE, READ, EDIT, ADD, DELETE] + scope: + type: owner + entity: Service + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: e4ce3338-9ac8-480a-8eb9-ac1442ec654b + key: property + attributes: [BROWSE, READ, EDIT] + scope: + type: owner + entity: Service + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: d0339d5c-fea7-4ea8-b002-8a84fa57e3e9 + key: entity + attributes: [BROWSE, READ, EDIT, ADD, DELETE] + scope: + type: owner + entity: Service + entity_uuid: 80078917-9650-4760-aa2c-9aa08a685dc3 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: d0339d5c-fea7-4ea8-b002-8a84fa57e3e9 + key: property + attributes: [BROWSE, READ, EDIT] + scope: + type: owner + entity: Service + entity_uuid: 80078917-9650-4760-aa2c-9aa08a685dc3 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: fca3ff59-ae91-48d4-b189-31d27093d405 + key: entity + attributes: [BROWSE, READ, EDIT, ADD, DELETE] + scope: + type: generic + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: fca3ff59-ae91-48d4-b189-31d27093d405 + key: property + attributes: [BROWSE, READ, EDIT] + scope: + type: generic + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: ea6ab451-6999-43c7-8f87-731dcdac72dd + key: entity + attributes: [BROWSE, READ, EDIT, ADD, DELETE] + scope: + type: property + property: uuid + value: 6211c7bd-a680-40ff-89e0-4c98aba229db + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: ea6ab451-6999-43c7-8f87-731dcdac72dd + key: property + attributes: [BROWSE, READ, EDIT] + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: 617e0602-40ea-4f94-b208-5ce1997c691f + key: entity + attributes: [BROWSE, READ, EDIT, ADD, DELETE] + scope: + type: property + property: title.en + value: Metadata 1 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: 617e0602-40ea-4f94-b208-5ce1997c691f + key: property + attributes: [BROWSE, READ, EDIT] + scope: + type: property + property: title.en + value: Metadata 1 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: 33a83ffe-1879-49f1-86b4-64c97d178dfe + key: entity + attributes: [BROWSE, READ, EDIT, ADD, DELETE] + scope: + type: property + property: data.attribute + value: true + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: 33a83ffe-1879-49f1-86b4-64c97d178dfe + key: property + attributes: [BROWSE, READ, EDIT] + scope: + type: property + property: data.attribute + value: true + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: 77b4306e-feb7-4f4d-9fa6-de1bfd073eed + key: entity + attributes: [BROWSE, READ, EDIT, ADD, DELETE] + scope: + type: property + property: data.attribute + value: string + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: 77b4306e-feb7-4f4d-9fa6-de1bfd073eed + key: property + attributes: [BROWSE, READ, EDIT] + scope: + type: property + property: data.attribute + value: string + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: b88188c1-5014-4e97-b321-757d0ffd0f24 + key: entity + attributes: [BROWSE, READ, EDIT, ADD, DELETE] + scope: + type: property + property: data.attribute + value: 123 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: b88188c1-5014-4e97-b321-757d0ffd0f24 + key: property + attributes: [BROWSE, READ, EDIT] + scope: + type: property + property: data.attribute + value: 123 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: ed65bd97-1170-4f7e-b1dc-1307ac70e555 + key: entity + attributes: [BROWSE, READ, EDIT, ADD, DELETE] + scope: + type: property + property: data.attribute + value: 4.56 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: ed65bd97-1170-4f7e-b1dc-1307ac70e555 + key: property + attributes: [BROWSE, READ, EDIT] + scope: + type: property + property: data.attribute + value: 4.56 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: 1a9a98f2-4d88-45ca-8b55-18e6e8915252 + key: entity + attributes: [BROWSE, READ, EDIT, ADD, DELETE] + scope: + type: property + property: data.attribute.subattribute + value: string + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: 1a9a98f2-4d88-45ca-8b55-18e6e8915252 + key: property + attributes: [BROWSE, READ, EDIT] + scope: + type: property + property: data.attribute.subattribute + value: string + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 prototype: access: ~ diff --git a/api/config/fixtures/test/metadata.yaml b/api/config/fixtures/test/metadata.yaml index 9318324..3d9c6ea 100644 --- a/api/config/fixtures/test/metadata.yaml +++ b/api/config/fixtures/test/metadata.yaml @@ -37,73 +37,93 @@ objects: owner: BusinessUnit owner_uuid: ~ title: - en: Metadata 1 - fr: Metadata 1 + en: Metadata 1 + fr: Metadata 1 slug: metadata-1 type: metadata data: - attribute: true + attribute: true tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - uuid: e816d4d3-76a1-4082-b99c-39c3e81cbb83 owner: BusinessUnit owner_uuid: ~ title: - en: Metadata 2 - fr: Metadata 2 + en: Metadata 2 + fr: Metadata 2 slug: metadata-2 type: metadata data: - attribute: "string" + attribute: "string" tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - uuid: c95a4acb-259a-40cd-ac0b-a303e2d1c894 owner: BusinessUnit owner_uuid: ~ title: - en: Metadata 3 - fr: Metadata 3 + en: Metadata 3 + fr: Metadata 3 slug: metadata-3 type: metadata data: - attribute: 123 + attribute: 123 tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - uuid: a235421c-0502-4ff3-b152-9d58ba279f92 owner: BusinessUnit owner_uuid: ~ title: - en: Metadata 4 - fr: Metadata 4 + en: Metadata 4 + fr: Metadata 4 slug: metadata-4 type: metadata data: - attribute: 1.23 + attribute: 4.56 tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - uuid: 8df80b6e-5f45-4e87-bd75-5f62ee86d4b0 owner: BusinessUnit owner_uuid: ~ title: - en: Metadata 5 - fr: Metadata 5 + en: Metadata 5 + fr: Metadata 5 slug: metadata-5 type: metadata data: - attribute: [] + attribute: [] tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - uuid: 82f3e242-6d6f-4b22-bdee-bc8dcb698514 owner: BusinessUnit owner_uuid: ~ title: - en: Metadata 6 - fr: Metadata 6 + en: Metadata 6 + fr: Metadata 6 slug: metadata-6 type: metadata data: - attribute: - subattribute: "string" + attribute: + subattribute: "string" + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 77954099-86df-47e5-9c05-57befd04efef + owner: Service + owner_uuid: ~ + title: + en: Metadata 7 + fr: Metadata 7 + slug: metadata-7 + type: metadata + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - uuid: 99c0ccfd-ed42-41e0-bf1a-5230acd9a129 + owner: Service + owner_uuid: 80078917-9650-4760-aa2c-9aa08a685dc3 + title: + en: Metadata 8 + fr: Metadata 8 + slug: metadata-8 + type: metadata tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 prototype: diff --git a/api/features/api/access/add.feature b/api/features/api/access/add.feature index a856633..3d26d45 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 25 + And the JSON node "id" should be equal to the number 30 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=25" + And I send a "GET" request to "/accesses?id=30" 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/metadata/add.feature b/api/features/api/metadata/add.feature index 4f418dd..66f64c4 100644 --- a/api/features/api/metadata/add.feature +++ b/api/features/api/metadata/add.feature @@ -28,7 +28,7 @@ Feature: Add metadata 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 9 + And the JSON node "id" should be equal to the number 11 And the JSON node "uuid" should exist And the JSON node "createdAt" should exist And the JSON node "updatedAt" should exist @@ -56,7 +56,7 @@ Feature: Add metadata Scenario: Read the added metadata When I add "Accept" header equal to "application/json" - And I send a "GET" request to "/metadata?id=9" + And I send a "GET" request to "/metadata?id=11" 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/metadata.feature b/api/features/api/security/acl/metadata.feature new file mode 100644 index 0000000..90ff2a7 --- /dev/null +++ b/api/features/api/security/acl/metadata.feature @@ -0,0 +1,312 @@ +@api @security @acl @metadata +Feature: Validate acl permissions on metadata endpoints + + Scenario: Browse all metadata with permission scope `owner = BusinessUnit` + Given I am authenticated as the "system@system.ds" user with identity role "df0d6e00-3582-4ccc-92f8-0425ba35bb0a" from the tenant "64c82518-017d-4fb2-9fcf-3926da3616e6" + When I add "Accept" header equal to "application/json" + And I send a "GET" request to "/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 should be valid according to this schema: + """ + { + "type": "array", + "minItems": 6, + "maxItems": 6, + "items": { + "type": "object", + "properties": { + "uuid": { + "type": "string", + "enum": [ + "6211c7bd-a680-40ff-89e0-4c98aba229db", + "e816d4d3-76a1-4082-b99c-39c3e81cbb83", + "c95a4acb-259a-40cd-ac0b-a303e2d1c894", + "a235421c-0502-4ff3-b152-9d58ba279f92", + "8df80b6e-5f45-4e87-bd75-5f62ee86d4b0", + "82f3e242-6d6f-4b22-bdee-bc8dcb698514" + ] + } + } + } + } + """ + + Scenario: Browse all metadata with permission scope `owner = Service` + Given I am authenticated as the "system@system.ds" user with identity role "359e49d3-2fd0-4a68-b5e2-99b74cd6a34c" from the tenant "64c82518-017d-4fb2-9fcf-3926da3616e6" + When I add "Accept" header equal to "application/json" + And I send a "GET" request to "/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 should be valid according to this schema: + """ + { + "type": "array", + "minItems": 2, + "maxItems": 2, + "items": { + "type": "object", + "properties": { + "uuid": { + "type": "string", + "enum": [ + "77954099-86df-47e5-9c05-57befd04efef", + "99c0ccfd-ed42-41e0-bf1a-5230acd9a129" + ] + } + } + } + } + """ + + Scenario: Browse all metadata with permission scope `owner = Service and owner uuid = 99c0ccfd-ed42-41e0-bf1a-5230acd9a129` + Given I am authenticated as the "system@system.ds" user with identity role "9c8cb648-b6fe-4730-8d5d-d8ad0cbe9072" from the tenant "64c82518-017d-4fb2-9fcf-3926da3616e6" + When I add "Accept" header equal to "application/json" + And I send a "GET" request to "/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 should be valid according to this schema: + """ + { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "properties": { + "uuid": { + "type": "string", + "enum": [ + "99c0ccfd-ed42-41e0-bf1a-5230acd9a129" + ] + } + } + } + } + """ + + Scenario: Browse all metadata with permission scope `generic` + Given I am authenticated as the "system@system.ds" user with identity role "fd8a9110-f41e-46e9-8109-31db9e187f71" from the tenant "64c82518-017d-4fb2-9fcf-3926da3616e6" + When I add "Accept" header equal to "application/json" + And I send a "GET" request to "/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 should be valid according to this schema: + """ + { + "type": "array", + "minItems": 8, + "maxItems": 8, + "items": { + "type": "object", + "properties": { + "uuid": { + "type": "string", + "enum": [ + "6211c7bd-a680-40ff-89e0-4c98aba229db", + "e816d4d3-76a1-4082-b99c-39c3e81cbb83", + "c95a4acb-259a-40cd-ac0b-a303e2d1c894", + "a235421c-0502-4ff3-b152-9d58ba279f92", + "8df80b6e-5f45-4e87-bd75-5f62ee86d4b0", + "82f3e242-6d6f-4b22-bdee-bc8dcb698514", + "77954099-86df-47e5-9c05-57befd04efef", + "99c0ccfd-ed42-41e0-bf1a-5230acd9a129" + ] + } + } + } + } + """ + + Scenario: Browse all metadata with permission scope `property uuid = 6211c7bd-a680-40ff-89e0-4c98aba229db` + Given I am authenticated as the "system@system.ds" user with identity role "c57e3d26-792b-492f-8095-b96bc83c8ba5" from the tenant "64c82518-017d-4fb2-9fcf-3926da3616e6" + When I add "Accept" header equal to "application/json" + And I send a "GET" request to "/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 should be valid according to this schema: + """ + { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "properties": { + "uuid": { + "type": "string", + "enum": [ + "6211c7bd-a680-40ff-89e0-4c98aba229db" + ] + } + } + } + } + """ + + Scenario: Browse all metadata with permission scope `property title.en = Metadata 1` + Given I am authenticated as the "system@system.ds" user with identity role "37a96b86-1610-492c-86b1-a57a2504d562" from the tenant "64c82518-017d-4fb2-9fcf-3926da3616e6" + When I add "Accept" header equal to "application/json" + And I send a "GET" request to "/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 should be valid according to this schema: + """ + { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "properties": { + "uuid": { + "type": "string", + "enum": [ + "6211c7bd-a680-40ff-89e0-4c98aba229db" + ] + } + } + } + } + """ + + Scenario: Browse all metadata with permission scope `property data.attribute = true` + Given I am authenticated as the "system@system.ds" user with identity role "7f4a80e0-8720-40af-b424-f4c827c17987" from the tenant "64c82518-017d-4fb2-9fcf-3926da3616e6" + When I add "Accept" header equal to "application/json" + And I send a "GET" request to "/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 should be valid according to this schema: + """ + { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "properties": { + "uuid": { + "type": "string", + "enum": [ + "6211c7bd-a680-40ff-89e0-4c98aba229db" + ] + } + } + } + } + """ + + Scenario: Browse all metadata with permission scope `property data.attribute = "string""` + Given I am authenticated as the "system@system.ds" user with identity role "72e33a99-d9c1-41d3-b2b6-c360ba03b016" from the tenant "64c82518-017d-4fb2-9fcf-3926da3616e6" + When I add "Accept" header equal to "application/json" + And I send a "GET" request to "/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 should be valid according to this schema: + """ + { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "properties": { + "uuid": { + "type": "string", + "enum": [ + "e816d4d3-76a1-4082-b99c-39c3e81cbb83" + ] + } + } + } + } + """ + + Scenario: Browse all metadata with permission scope `property data.attribute = 123` + Given I am authenticated as the "system@system.ds" user with identity role "e37f9cea-2f85-46e8-ad02-96bc0f4ce24a" from the tenant "64c82518-017d-4fb2-9fcf-3926da3616e6" + When I add "Accept" header equal to "application/json" + And I send a "GET" request to "/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 should be valid according to this schema: + """ + { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "properties": { + "uuid": { + "type": "string", + "enum": [ + "c95a4acb-259a-40cd-ac0b-a303e2d1c894" + ] + } + } + } + } + """ + + Scenario: Browse all metadata with permission scope `property data.attribute = 4.56` + Given I am authenticated as the "system@system.ds" user with identity role "fd71f9c1-45d0-4108-b1ec-fba860ad5808" from the tenant "64c82518-017d-4fb2-9fcf-3926da3616e6" + When I add "Accept" header equal to "application/json" + And I send a "GET" request to "/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 should be valid according to this schema: + """ + { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "properties": { + "uuid": { + "type": "string", + "enum": [ + "a235421c-0502-4ff3-b152-9d58ba279f92" + ] + } + } + } + } + """ + + Scenario: Browse all metadata with permission scope `property data.attribute.subattribute = "string"` + Given I am authenticated as the "system@system.ds" user with identity role "30328696-956f-4f5c-bc65-f0312a5c7d63" from the tenant "64c82518-017d-4fb2-9fcf-3926da3616e6" + When I add "Accept" header equal to "application/json" + And I send a "GET" request to "/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 should be valid according to this schema: + """ + { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "properties": { + "uuid": { + "type": "string", + "enum": [ + "82f3e242-6d6f-4b22-bdee-bc8dcb698514" + ] + } + } + } + } + """ From 859a776632fd137f127b9ab0972be1284a89922e Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 9 Aug 2020 17:48:11 -0400 Subject: [PATCH 20/27] Update behat tests --- api/composer.lock | 6 ++--- .../fixtures/test/access/role/access.yaml | 4 ++++ .../fixtures/test/access/role/permission.yaml | 20 ++++++++++++++++ api/config/fixtures/test/metadata.yaml | 24 +++++++++---------- api/features/api/access/add.feature | 4 ++-- api/features/api/metadata/add.feature | 4 ++-- .../api/security/acl/metadata.feature | 18 +++++++------- 7 files changed, 51 insertions(+), 29 deletions(-) diff --git a/api/composer.lock b/api/composer.lock index f9e26cc..20d6c2e 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "3ac6aafc05e9f9493ae0d28c9d4a8a6a8a048b53" + "reference": "9d74194d6f31eab5312e13bc7af9846a438e5bdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/3ac6aafc05e9f9493ae0d28c9d4a8a6a8a048b53", - "reference": "3ac6aafc05e9f9493ae0d28c9d4a8a6a8a048b53", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/9d74194d6f31eab5312e13bc7af9846a438e5bdb", + "reference": "9d74194d6f31eab5312e13bc7af9846a438e5bdb", "shasum": "" }, "require": { diff --git a/api/config/fixtures/test/access/role/access.yaml b/api/config/fixtures/test/access/role/access.yaml index a23d485..285112e 100644 --- a/api/config/fixtures/test/access/role/access.yaml +++ b/api/config/fixtures/test/access/role/access.yaml @@ -43,6 +43,10 @@ objects: assignee_uuid: 30328696-956f-4f5c-bc65-f0312a5c7d63 tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + - uuid: cb12c8d6-81d3-46db-b687-21de7d92d2f0 + assignee_uuid: 6134980b-d4c0-41b8-b874-ee4308717297 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + prototype: uuid: ~ owner: BusinessUnit diff --git a/api/config/fixtures/test/access/role/permission.yaml b/api/config/fixtures/test/access/role/permission.yaml index 2ecafb3..78afc85 100644 --- a/api/config/fixtures/test/access/role/permission.yaml +++ b/api/config/fixtures/test/access/role/permission.yaml @@ -185,6 +185,26 @@ objects: value: string tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + - access: cb12c8d6-81d3-46db-b687-21de7d92d2f0 + key: entity + attributes: [BROWSE, READ, EDIT, ADD, DELETE] + scope: + type: property + property: data.attribute + comparison: like + value: str + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + + - access: cb12c8d6-81d3-46db-b687-21de7d92d2f0 + key: property + attributes: [BROWSE, READ, EDIT] + scope: + type: property + property: data.attribute + comparison: like + value: str + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + prototype: access: ~ scope: diff --git a/api/config/fixtures/test/metadata.yaml b/api/config/fixtures/test/metadata.yaml index 3d9c6ea..689ebd0 100644 --- a/api/config/fixtures/test/metadata.yaml +++ b/api/config/fixtures/test/metadata.yaml @@ -93,18 +93,18 @@ objects: attribute: [] tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - - uuid: 82f3e242-6d6f-4b22-bdee-bc8dcb698514 - owner: BusinessUnit - owner_uuid: ~ - title: - en: Metadata 6 - fr: Metadata 6 - slug: metadata-6 - type: metadata - data: - attribute: - subattribute: "string" - tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 +# - uuid: 82f3e242-6d6f-4b22-bdee-bc8dcb698514 +# owner: BusinessUnit +# owner_uuid: ~ +# title: +# en: Metadata 6 +# fr: Metadata 6 +# slug: metadata-6 +# type: metadata +# data: +# attribute: +# subattribute: "string" +# tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 - uuid: 77954099-86df-47e5-9c05-57befd04efef owner: Service diff --git a/api/features/api/access/add.feature b/api/features/api/access/add.feature index 3d26d45..d66956a 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 30 + And the JSON node "id" should be equal to the number 31 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=30" + And I send a "GET" request to "/accesses?id=31" 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/metadata/add.feature b/api/features/api/metadata/add.feature index 66f64c4..6f4fbed 100644 --- a/api/features/api/metadata/add.feature +++ b/api/features/api/metadata/add.feature @@ -28,7 +28,7 @@ Feature: Add metadata 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 11 + And the JSON node "id" should be equal to the number 10 And the JSON node "uuid" should exist And the JSON node "createdAt" should exist And the JSON node "updatedAt" should exist @@ -56,7 +56,7 @@ Feature: Add metadata Scenario: Read the added metadata When I add "Accept" header equal to "application/json" - And I send a "GET" request to "/metadata?id=11" + And I send a "GET" request to "/metadata?id=10" 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/metadata.feature b/api/features/api/security/acl/metadata.feature index 90ff2a7..26fa2ee 100644 --- a/api/features/api/security/acl/metadata.feature +++ b/api/features/api/security/acl/metadata.feature @@ -12,8 +12,8 @@ Feature: Validate acl permissions on metadata endpoints """ { "type": "array", - "minItems": 6, - "maxItems": 6, + "minItems": 5, + "maxItems": 5, "items": { "type": "object", "properties": { @@ -24,8 +24,7 @@ Feature: Validate acl permissions on metadata endpoints "e816d4d3-76a1-4082-b99c-39c3e81cbb83", "c95a4acb-259a-40cd-ac0b-a303e2d1c894", "a235421c-0502-4ff3-b152-9d58ba279f92", - "8df80b6e-5f45-4e87-bd75-5f62ee86d4b0", - "82f3e242-6d6f-4b22-bdee-bc8dcb698514" + "8df80b6e-5f45-4e87-bd75-5f62ee86d4b0" ] } } @@ -99,8 +98,8 @@ Feature: Validate acl permissions on metadata endpoints """ { "type": "array", - "minItems": 8, - "maxItems": 8, + "minItems": 7, + "maxItems": 7, "items": { "type": "object", "properties": { @@ -112,7 +111,6 @@ Feature: Validate acl permissions on metadata endpoints "c95a4acb-259a-40cd-ac0b-a303e2d1c894", "a235421c-0502-4ff3-b152-9d58ba279f92", "8df80b6e-5f45-4e87-bd75-5f62ee86d4b0", - "82f3e242-6d6f-4b22-bdee-bc8dcb698514", "77954099-86df-47e5-9c05-57befd04efef", "99c0ccfd-ed42-41e0-bf1a-5230acd9a129" ] @@ -284,8 +282,8 @@ Feature: Validate acl permissions on metadata endpoints } """ - Scenario: Browse all metadata with permission scope `property data.attribute.subattribute = "string"` - Given I am authenticated as the "system@system.ds" user with identity role "30328696-956f-4f5c-bc65-f0312a5c7d63" from the tenant "64c82518-017d-4fb2-9fcf-3926da3616e6" + Scenario: Browse all metadata with permission scope `property data.attribute like "str"` + Given I am authenticated as the "system@system.ds" user with identity role "6134980b-d4c0-41b8-b874-ee4308717297" from the tenant "64c82518-017d-4fb2-9fcf-3926da3616e6" When I add "Accept" header equal to "application/json" And I send a "GET" request to "/metadata" Then the response status code should be 200 @@ -303,7 +301,7 @@ Feature: Validate acl permissions on metadata endpoints "uuid": { "type": "string", "enum": [ - "82f3e242-6d6f-4b22-bdee-bc8dcb698514" + "e816d4d3-76a1-4082-b99c-39c3e81cbb83" ] } } From 6c5a5908f337125e523eb89b4699e857baec9911 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 9 Aug 2020 21:16:17 -0400 Subject: [PATCH 21/27] 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 20d6c2e..a951812 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "9d74194d6f31eab5312e13bc7af9846a438e5bdb" + "reference": "43e1155fae8e6610964893b0fe520de8848abd3a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/9d74194d6f31eab5312e13bc7af9846a438e5bdb", - "reference": "9d74194d6f31eab5312e13bc7af9846a438e5bdb", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/43e1155fae8e6610964893b0fe520de8848abd3a", + "reference": "43e1155fae8e6610964893b0fe520de8848abd3a", "shasum": "" }, "require": { From 8b69cc57014389a960cb66fe0c9fa6ae1911c7f7 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 30 Aug 2020 14:38:17 -0400 Subject: [PATCH 22/27] 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/config.yaml | 1 + api/config/fixtures/dev/metadata.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/config.yaml | 1 + api/config/fixtures/test/metadata.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/config/edit.feature | 6 +++--- api/features/api/metadata/add.feature | 2 ++ api/features/api/metadata/edit.feature | 6 +++--- 25 files changed, 36 insertions(+), 14 deletions(-) diff --git a/api/composer.lock b/api/composer.lock index a951812..701864e 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 69d2036..98f9576 100644 --- a/api/config/fixtures/dev/access/anonymous/access.yaml +++ b/api/config/fixtures/dev/access/anonymous/access.yaml @@ -2,6 +2,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 dfe7630..3318fdd 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 d49418a..23d354e 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 3831ed2..6b192dd 100644 --- a/api/config/fixtures/dev/access/role/access.yaml +++ b/api/config/fixtures/dev/access/role/access.yaml @@ -4,6 +4,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 3546239..0989c22 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 e262009..e1ccf23 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/config.yaml b/api/config/fixtures/dev/config.yaml index 5079584..b943cc5 100644 --- a/api/config/fixtures/dev/config.yaml +++ b/api/config/fixtures/dev/config.yaml @@ -33,6 +33,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 8130c48..16c7828 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/system/tenant.yaml b/api/config/fixtures/dev/system/tenant.yaml index feb4948..a0dbc08 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 9e36d6b..d829923 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 aaa8ff8..2193281 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 2076780..2fca348 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 285112e..ab8a2d8 100644 --- a/api/config/fixtures/test/access/role/access.yaml +++ b/api/config/fixtures/test/access/role/access.yaml @@ -49,6 +49,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 ad17410..7c85969 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 c537460..2f5d711 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/config.yaml b/api/config/fixtures/test/config.yaml index b7ef970..cf6942d 100644 --- a/api/config/fixtures/test/config.yaml +++ b/api/config/fixtures/test/config.yaml @@ -145,6 +145,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 689ebd0..5f141b3 100644 --- a/api/config/fixtures/test/metadata.yaml +++ b/api/config/fixtures/test/metadata.yaml @@ -128,6 +128,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ title: {} diff --git a/api/config/fixtures/test/system/tenant.yaml b/api/config/fixtures/test/system/tenant.yaml index 7be4c9d..8566697 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 95668d2..bf12dce 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 d66956a..49ba589 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 31 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 50a9cb3..a821212 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/7fe88e83-5fdb-4487-bb78-caa897e6911f" 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 "7fe88e83-5fdb-4487-bb78-caa897e6911f" - 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 "7fe88e83-5fdb-4487-bb78-caa897e6911f" - 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/config/edit.feature b/api/features/api/config/edit.feature index a39fe39..257e388 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/b678a6cd-7b84-4495-9ac6-51c41c4320f6" 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 "b678a6cd-7b84-4495-9ac6-51c41c4320f6" - 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 "b678a6cd-7b84-4495-9ac6-51c41c4320f6" - 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 6f4fbed..1e42663 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 10 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 12f4f55..e2e175a 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/049ec314-020c-44bf-b4fc-0ea5f5171fa5" 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 "049ec314-020c-44bf-b4fc-0ea5f5171fa5" - 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 "049ec314-020c-44bf-b4fc-0ea5f5171fa5" - 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" From 86aa4e8cd6ff60d838ee0d70698c0e04d93980ca Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 30 Aug 2020 15:21:47 -0400 Subject: [PATCH 23/27] 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 34dd864..f165f3d 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 85d5e9af7be7db27ff2472da3022f1a7ceac0143 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Mon, 31 Aug 2020 06:42:56 -0400 Subject: [PATCH 24/27] 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 bf12dce..95668d2 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 57981ca40187d34b284d56b60b4aff37e65a838e Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Wed, 16 Sep 2020 19:44:26 -0400 Subject: [PATCH 25/27] 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 0ba5d91..ca45b6e 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 701864e..3c71c10 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": "23f583548c8239e0cc1928954e0ff26b", + "content-hash": "38d487c489738605b91798cd79ebaca7", "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 a230c1b64d8bcf0cc245e4acf6e3ec01499e0320 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sat, 31 Oct 2020 17:01:36 -0400 Subject: [PATCH 26/27] 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 e316e63..18474ad 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 473115df45e8cf5ec15b1558743408854dfa2087 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Tue, 2 Feb 2021 19:13:51 -0500 Subject: [PATCH 27/27] 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 5b9cc6a..4fce1a7 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 ca45b6e..e6e67dd 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"