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/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 diff --git a/api/composer.json b/api/composer.json index 8bc2429..e6e67dd 100644 --- a/api/composer.json +++ b/api/composer.json @@ -11,13 +11,15 @@ "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", + "justinrainbow/json-schema": "^5.0", "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", @@ -66,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" diff --git a/api/composer.lock b/api/composer.lock index bed2359..3c71c10 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": "38d487c489738605b91798cd79ebaca7", "packages": [ { "name": "api-platform/api-pack", @@ -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": "ddd320c3aacb7c5e7bdb962b5d2715abcb1dd9d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/c94e4b990ef1a7f1adc76b89d06d95f6a47721ec", - "reference": "c94e4b990ef1a7f1adc76b89d06d95f6a47721ec", + "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", @@ -2997,6 +3063,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 +6375,7 @@ "code", "zf2" ], + "abandoned": "laminas/laminas-code", "time": "2018-08-13T20:36:59+00:00" }, { @@ -6301,6 +6430,7 @@ "events", "zf2" ], + "abandoned": "laminas/laminas-eventmanager", "time": "2018-04-25T15:33:34+00:00" } ], @@ -6936,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" }, { @@ -6943,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": "" }, @@ -7096,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", @@ -7883,5 +7948,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/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/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/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 fb18ad2..ab8a2d8 100644 --- a/api/config/fixtures/test/access/role/access.yaml +++ b/api/config/fixtures/test/access/role/access.yaml @@ -1,7 +1,55 @@ -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 + + - 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 + + - uuid: cb12c8d6-81d3-46db-b687-21de7d92d2f0 + assignee_uuid: 6134980b-d4c0-41b8-b874-ee4308717297 + tenant: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ assignee: Role diff --git a/api/config/fixtures/test/access/role/permission.yaml b/api/config/fixtures/test/access/role/permission.yaml index a50e99b..78afc85 100644 --- a/api/config/fixtures/test/access/role/permission.yaml +++ b/api/config/fixtures/test/access/role/permission.yaml @@ -1,4 +1,209 @@ -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 + + - 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: ~ 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 7c90d3b..cf6942d 100644 --- a/api/config/fixtures/test/config.yaml +++ b/api/config/fixtures/test/config.yaml @@ -95,8 +95,57 @@ 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: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ key: ~ diff --git a/api/config/fixtures/test/metadata.yaml b/api/config/fixtures/test/metadata.yaml index 4231981..5f141b3 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,10 +30,105 @@ 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: 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 + 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 + + - 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: 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 748d82c..8566697 100644 --- a/api/config/fixtures/test/system/tenant.yaml +++ b/api/config/fixtures/test/system/tenant.yaml @@ -3,6 +3,9 @@ objects: - uuid: 92000deb-b847-4838-915c-b95d2b28e960 # Tenant 2 + - uuid: 64c82518-017d-4fb2-9fcf-3926da3616e6 # Tenant 0 + prototype: uuid: ~ + created_at: ~ data: {} 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 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/features/api/access/add.feature b/api/features/api/access/add.feature index fdae0d8..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", @@ -22,9 +23,10 @@ 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 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" @@ -39,7 +41,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=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/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 b5fc857..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": { @@ -28,9 +29,10 @@ 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 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 @@ -56,7 +58,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=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/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" diff --git a/api/features/api/security/acl/metadata.feature b/api/features/api/security/acl/metadata.feature new file mode 100644 index 0000000..26fa2ee --- /dev/null +++ b/api/features/api/security/acl/metadata.feature @@ -0,0 +1,310 @@ +@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": 5, + "maxItems": 5, + "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" + ] + } + } + } + } + """ + + 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": 7, + "maxItems": 7, + "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", + "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 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 + 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" + ] + } + } + } + } + """ diff --git a/api/features/api/system/tenant/add.feature b/api/features/api/system/tenant/add.feature index ae37de8..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": { @@ -66,10 +67,11 @@ 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 + 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 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": { 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": { 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: