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 0d2a620..8045fc0 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 aac266e..da23014 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": "0fed830c88f1dd770c7c308e61eef1dd", + "content-hash": "a30801307d3efc8e93c107e03b97795d", "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 1a9ad49..75425b8 100644 --- a/api/config/fixtures/dev/access/role/access.yaml +++ b/api/config/fixtures/dev/access/role/access.yaml @@ -16,6 +16,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: c11c546e-bd01-47cf-97da-e25388357b5a # Administration assignee: Role diff --git a/api/config/fixtures/dev/access/role/permission.yaml b/api/config/fixtures/dev/access/role/permission.yaml index dcdffd6..43eb6b2 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 1e032b8..5765605 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/business_unit.yaml b/api/config/fixtures/dev/business_unit.yaml index b9e5f2d..96ad4ad 100644 --- a/api/config/fixtures/dev/business_unit.yaml +++ b/api/config/fixtures/dev/business_unit.yaml @@ -16,6 +16,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: c11c546e-bd01-47cf-97da-e25388357b5a # Administration title: {} diff --git a/api/config/fixtures/dev/business_unit/role.yaml b/api/config/fixtures/dev/business_unit/role.yaml new file mode 100644 index 0000000..2b14a40 --- /dev/null +++ b/api/config/fixtures/dev/business_unit/role.yaml @@ -0,0 +1,11 @@ +objects: [] + +prototype: + business_unit: ~ + uuid: ~ + created_at: ~ + owner: BusinessUnit + owner_uuid: ~ + role: ~ + entity_uuids: [] + tenant: e5a2120d-6bf7-4c58-a900-bac1e55e986b # Tenant 1 diff --git a/api/config/fixtures/dev/config.yaml b/api/config/fixtures/dev/config.yaml index 3b26461..1ff0c6d 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/identity/anonymous/identity.yaml b/api/config/fixtures/dev/identity/anonymous/identity.yaml index 7071259..61060ed 100644 --- a/api/config/fixtures/dev/identity/anonymous/identity.yaml +++ b/api/config/fixtures/dev/identity/anonymous/identity.yaml @@ -2,6 +2,7 @@ objects: [] prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ tenant: e5a2120d-6bf7-4c58-a900-bac1e55e986b # Tenant 1 diff --git a/api/config/fixtures/dev/identity/anonymous/persona.yaml b/api/config/fixtures/dev/identity/anonymous/persona.yaml index 94e2b84..dcccbd7 100644 --- a/api/config/fixtures/dev/identity/anonymous/persona.yaml +++ b/api/config/fixtures/dev/identity/anonymous/persona.yaml @@ -3,6 +3,7 @@ objects: [] prototype: anonymous: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ title: diff --git a/api/config/fixtures/dev/identity/anonymous/role.yaml b/api/config/fixtures/dev/identity/anonymous/role.yaml index d92d410..800d741 100644 --- a/api/config/fixtures/dev/identity/anonymous/role.yaml +++ b/api/config/fixtures/dev/identity/anonymous/role.yaml @@ -3,8 +3,9 @@ objects: [] prototype: anonymous: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ role: ~ - business_units: [] + entity_uuids: [] tenant: e5a2120d-6bf7-4c58-a900-bac1e55e986b # Tenant 1 diff --git a/api/config/fixtures/dev/identity/individual/identity.yaml b/api/config/fixtures/dev/identity/individual/identity.yaml index 52d6c45..948b683 100644 --- a/api/config/fixtures/dev/identity/individual/identity.yaml +++ b/api/config/fixtures/dev/identity/individual/identity.yaml @@ -5,6 +5,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: a9d68bf7-5000-49fe-8b00-33dde235b327 # Backoffice tenant: e5a2120d-6bf7-4c58-a900-bac1e55e986b # Tenant 1 diff --git a/api/config/fixtures/dev/identity/individual/persona.yaml b/api/config/fixtures/dev/identity/individual/persona.yaml index 8dbe46d..4bb7bfb 100644 --- a/api/config/fixtures/dev/identity/individual/persona.yaml +++ b/api/config/fixtures/dev/identity/individual/persona.yaml @@ -36,6 +36,7 @@ objects: prototype: individual: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ title: diff --git a/api/config/fixtures/dev/identity/individual/role.yaml b/api/config/fixtures/dev/identity/individual/role.yaml index a02adf5..3d425a4 100644 --- a/api/config/fixtures/dev/identity/individual/role.yaml +++ b/api/config/fixtures/dev/identity/individual/role.yaml @@ -8,8 +8,9 @@ objects: prototype: individual: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: a9d68bf7-5000-49fe-8b00-33dde235b327 # Backoffice role: 54d82fc6-8ce7-498e-832f-3598664a9d9d # Individual - business_units: [] + entity_uuids: [] tenant: e5a2120d-6bf7-4c58-a900-bac1e55e986b # Tenant 1 diff --git a/api/config/fixtures/dev/identity/organization/identity.yaml b/api/config/fixtures/dev/identity/organization/identity.yaml index 1a6bfae..0e7cdf8 100644 --- a/api/config/fixtures/dev/identity/organization/identity.yaml +++ b/api/config/fixtures/dev/identity/organization/identity.yaml @@ -3,6 +3,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: a9d68bf7-5000-49fe-8b00-33dde235b327 # Backoffice tenant: e5a2120d-6bf7-4c58-a900-bac1e55e986b # Tenant 1 diff --git a/api/config/fixtures/dev/identity/organization/persona.yaml b/api/config/fixtures/dev/identity/organization/persona.yaml index 09b391c..9cd63f5 100644 --- a/api/config/fixtures/dev/identity/organization/persona.yaml +++ b/api/config/fixtures/dev/identity/organization/persona.yaml @@ -19,6 +19,7 @@ objects: prototype: individual: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ title: diff --git a/api/config/fixtures/dev/identity/organization/role.yaml b/api/config/fixtures/dev/identity/organization/role.yaml index 180740a..8aa93c2 100644 --- a/api/config/fixtures/dev/identity/organization/role.yaml +++ b/api/config/fixtures/dev/identity/organization/role.yaml @@ -6,8 +6,9 @@ objects: prototype: organization: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: a9d68bf7-5000-49fe-8b00-33dde235b327 # Backoffice role: ~ - business_units: [] + entity_uuids: [] tenant: e5a2120d-6bf7-4c58-a900-bac1e55e986b # Tenant 1 diff --git a/api/config/fixtures/dev/identity/staff/identity.yaml b/api/config/fixtures/dev/identity/staff/identity.yaml index 4bfa662..f900351 100644 --- a/api/config/fixtures/dev/identity/staff/identity.yaml +++ b/api/config/fixtures/dev/identity/staff/identity.yaml @@ -18,6 +18,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: a9d68bf7-5000-49fe-8b00-33dde235b327 # Backoffice business_units: [] diff --git a/api/config/fixtures/dev/identity/staff/persona.yaml b/api/config/fixtures/dev/identity/staff/persona.yaml index 2985f07..f33bdff 100644 --- a/api/config/fixtures/dev/identity/staff/persona.yaml +++ b/api/config/fixtures/dev/identity/staff/persona.yaml @@ -12,6 +12,7 @@ objects: prototype: staff: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: a9d68bf7-5000-49fe-8b00-33dde235b327 # Backoffice title: diff --git a/api/config/fixtures/dev/identity/staff/role.yaml b/api/config/fixtures/dev/identity/staff/role.yaml index b1f4081..45348df 100644 --- a/api/config/fixtures/dev/identity/staff/role.yaml +++ b/api/config/fixtures/dev/identity/staff/role.yaml @@ -19,8 +19,9 @@ objects: prototype: staff: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: a9d68bf7-5000-49fe-8b00-33dde235b327 # Backoffice role: ~ - business_units: [] + entity_uuids: [] tenant: e5a2120d-6bf7-4c58-a900-bac1e55e986b # Tenant 1 diff --git a/api/config/fixtures/dev/identity/system/identity.yaml b/api/config/fixtures/dev/identity/system/identity.yaml index 9434654..7390846 100644 --- a/api/config/fixtures/dev/identity/system/identity.yaml +++ b/api/config/fixtures/dev/identity/system/identity.yaml @@ -7,6 +7,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: System owner_uuid: ~ tenant: e5a2120d-6bf7-4c58-a900-bac1e55e986b # Tenant 1 diff --git a/api/config/fixtures/dev/identity/system/role.yaml b/api/config/fixtures/dev/identity/system/role.yaml index ba80ea6..83c4de2 100644 --- a/api/config/fixtures/dev/identity/system/role.yaml +++ b/api/config/fixtures/dev/identity/system/role.yaml @@ -3,8 +3,9 @@ objects: [] prototype: system: ~ uuid: ~ + created_at: ~ owner: System owner_uuid: ~ role: ~ - business_units: [] + entity_uuids: [] tenant: e5a2120d-6bf7-4c58-a900-bac1e55e986b # Tenant 1 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/role.yaml b/api/config/fixtures/dev/role.yaml index 31d2992..3499316 100644 --- a/api/config/fixtures/dev/role.yaml +++ b/api/config/fixtures/dev/role.yaml @@ -31,6 +31,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 fccaa0b..95d0042 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 b5f8175..c3c76c8 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 58a145d..49d077b 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..a70eb55 100644 --- a/api/config/fixtures/test/access/role/access.yaml +++ b/api/config/fixtures/test/access/role/access.yaml @@ -2,6 +2,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 0fb186f..309f36b 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 72f14e8..1f01b1f 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/business_unit.yaml b/api/config/fixtures/test/business_unit.yaml index ef4f6e3..e0dd07c 100644 --- a/api/config/fixtures/test/business_unit.yaml +++ b/api/config/fixtures/test/business_unit.yaml @@ -43,6 +43,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ title: {} diff --git a/api/config/fixtures/test/business_unit/role.yaml b/api/config/fixtures/test/business_unit/role.yaml new file mode 100644 index 0000000..161f5b9 --- /dev/null +++ b/api/config/fixtures/test/business_unit/role.yaml @@ -0,0 +1,11 @@ +objects: [] + +prototype: + business_unit: ~ + uuid: ~ + created_at: ~ + owner: BusinessUnit + owner_uuid: ~ + role: ~ + entity_uuids: [] + tenant: ~ diff --git a/api/config/fixtures/test/config.yaml b/api/config/fixtures/test/config.yaml index 5aa137e..e3bcb19 100644 --- a/api/config/fixtures/test/config.yaml +++ b/api/config/fixtures/test/config.yaml @@ -97,6 +97,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ key: ~ diff --git a/api/config/fixtures/test/identity/anonymous/identity.yaml b/api/config/fixtures/test/identity/anonymous/identity.yaml index b32d1a5..2525b46 100644 --- a/api/config/fixtures/test/identity/anonymous/identity.yaml +++ b/api/config/fixtures/test/identity/anonymous/identity.yaml @@ -11,6 +11,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ tenant: ~ diff --git a/api/config/fixtures/test/identity/anonymous/persona.yaml b/api/config/fixtures/test/identity/anonymous/persona.yaml index e57d839..95a9307 100644 --- a/api/config/fixtures/test/identity/anonymous/persona.yaml +++ b/api/config/fixtures/test/identity/anonymous/persona.yaml @@ -3,6 +3,7 @@ objects: [] prototype: anonymous: ~ uuid: ~ + created_at: ~ owner: ~ owner_uuid: ~ title: {} diff --git a/api/config/fixtures/test/identity/anonymous/role.yaml b/api/config/fixtures/test/identity/anonymous/role.yaml index fc41128..70e8141 100644 --- a/api/config/fixtures/test/identity/anonymous/role.yaml +++ b/api/config/fixtures/test/identity/anonymous/role.yaml @@ -3,8 +3,9 @@ objects: [] prototype: anonymous: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ role: ~ - business_units: [] + entity_uuids: [] tenant: ~ diff --git a/api/config/fixtures/test/identity/individual/identity.yaml b/api/config/fixtures/test/identity/individual/identity.yaml index 1e73a92..a966030 100644 --- a/api/config/fixtures/test/identity/individual/identity.yaml +++ b/api/config/fixtures/test/identity/individual/identity.yaml @@ -9,6 +9,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ tenant: ~ diff --git a/api/config/fixtures/test/identity/individual/persona.yaml b/api/config/fixtures/test/identity/individual/persona.yaml index 8ff9cec..7be910f 100644 --- a/api/config/fixtures/test/identity/individual/persona.yaml +++ b/api/config/fixtures/test/identity/individual/persona.yaml @@ -3,6 +3,7 @@ objects: [] prototype: individual: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ title: {} diff --git a/api/config/fixtures/test/identity/individual/role.yaml b/api/config/fixtures/test/identity/individual/role.yaml index 171e245..e9969cb 100644 --- a/api/config/fixtures/test/identity/individual/role.yaml +++ b/api/config/fixtures/test/identity/individual/role.yaml @@ -3,8 +3,9 @@ objects: [] prototype: individual: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ role: ~ - business_units: [] + entity_uuids: [] tenant: ~ diff --git a/api/config/fixtures/test/identity/organization/identity.yaml b/api/config/fixtures/test/identity/organization/identity.yaml index 185d44e..1e06211 100644 --- a/api/config/fixtures/test/identity/organization/identity.yaml +++ b/api/config/fixtures/test/identity/organization/identity.yaml @@ -9,6 +9,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ tenant: ~ diff --git a/api/config/fixtures/test/identity/organization/persona.yaml b/api/config/fixtures/test/identity/organization/persona.yaml index 8ff9cec..7be910f 100644 --- a/api/config/fixtures/test/identity/organization/persona.yaml +++ b/api/config/fixtures/test/identity/organization/persona.yaml @@ -3,6 +3,7 @@ objects: [] prototype: individual: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ title: {} diff --git a/api/config/fixtures/test/identity/organization/role.yaml b/api/config/fixtures/test/identity/organization/role.yaml index e0b2c45..95e98bf 100644 --- a/api/config/fixtures/test/identity/organization/role.yaml +++ b/api/config/fixtures/test/identity/organization/role.yaml @@ -3,8 +3,9 @@ objects: [] prototype: organization: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ role: ~ - business_units: [] + entity_uuids: [] tenant: ~ diff --git a/api/config/fixtures/test/identity/staff/identity.yaml b/api/config/fixtures/test/identity/staff/identity.yaml index 4f9cb6b..3f7b4b0 100644 --- a/api/config/fixtures/test/identity/staff/identity.yaml +++ b/api/config/fixtures/test/identity/staff/identity.yaml @@ -9,6 +9,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ business_units: [] diff --git a/api/config/fixtures/test/identity/staff/persona.yaml b/api/config/fixtures/test/identity/staff/persona.yaml index c7d9eaf..f484bf6 100644 --- a/api/config/fixtures/test/identity/staff/persona.yaml +++ b/api/config/fixtures/test/identity/staff/persona.yaml @@ -3,6 +3,7 @@ objects: [] prototype: staff: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ title: {} diff --git a/api/config/fixtures/test/identity/staff/role.yaml b/api/config/fixtures/test/identity/staff/role.yaml index 4c3657b..e423e0b 100644 --- a/api/config/fixtures/test/identity/staff/role.yaml +++ b/api/config/fixtures/test/identity/staff/role.yaml @@ -3,8 +3,9 @@ objects: [] prototype: staff: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ role: ~ - business_units: [] + entity_uuids: [] tenant: ~ diff --git a/api/config/fixtures/test/identity/system/identity.yaml b/api/config/fixtures/test/identity/system/identity.yaml index 2e60176..ef5f1af 100644 --- a/api/config/fixtures/test/identity/system/identity.yaml +++ b/api/config/fixtures/test/identity/system/identity.yaml @@ -9,6 +9,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: System owner_uuid: ~ tenant: ~ diff --git a/api/config/fixtures/test/identity/system/role.yaml b/api/config/fixtures/test/identity/system/role.yaml index 7d75e8c..c206ae5 100644 --- a/api/config/fixtures/test/identity/system/role.yaml +++ b/api/config/fixtures/test/identity/system/role.yaml @@ -3,6 +3,7 @@ objects: [] prototype: system: ~ uuid: ~ + created_at: ~ owner: System owner_uuid: ~ role: ~ diff --git a/api/config/fixtures/test/metadata.yaml b/api/config/fixtures/test/metadata.yaml index 5d44c60..2d86cbf 100644 --- a/api/config/fixtures/test/metadata.yaml +++ b/api/config/fixtures/test/metadata.yaml @@ -33,6 +33,7 @@ objects: prototype: uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ title: {} diff --git a/api/config/fixtures/test/role.yaml b/api/config/fixtures/test/role.yaml index 6a5ab76..0e53182 100644 --- a/api/config/fixtures/test/role.yaml +++ b/api/config/fixtures/test/role.yaml @@ -81,6 +81,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 748d82c..77cf647 100644 --- a/api/config/fixtures/test/system/tenant.yaml +++ b/api/config/fixtures/test/system/tenant.yaml @@ -5,4 +5,5 @@ objects: prototype: uuid: ~ + created_at: ~ data: {} diff --git a/api/config/packages/api_platform.yaml b/api/config/packages/api_platform.yaml index 0804f5b..5560b63 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: Identities - version: 0.18.2 + version: 0.19.0 collection: pagination: page_parameter_name: _page @@ -90,11 +90,34 @@ services: - { name: api_platform.filter, id: app.anonymous_persona.order } app.filter.anonymous_role.search: - parent: api_platform.doctrine.orm.search_filter - arguments: - - anonymous.uuid: exact - tags: - - { name: api_platform.filter, id: app.anonymous_role.search } + parent: api_platform.doctrine.orm.search_filter + arguments: + - id: exact + uuid: exact + owner: exact + ownerUuid: exact + anonymous.uuid: exact + role.uuid: exact + tags: + - { name: api_platform.filter, id: app.anonymous_role.search } + + app.filter.anonymous_role.date: + parent: api_platform.doctrine.orm.date_filter + arguments: + - createdAt: ~ + updatedAt: ~ + tags: + - { name: api_platform.filter, id: app.anonymous_role.date } + + app.filter.anonymous_role.order: + parent: api_platform.doctrine.orm.order_filter + arguments: + - id: ~ + createdAt: ~ + updatedAt: ~ + owner: ~ + tags: + - { name: api_platform.filter, id: app.anonymous_role.order } app.filter.business_unit.search: parent: api_platform.doctrine.orm.search_filter @@ -133,6 +156,37 @@ services: tags: - { name: api_platform.filter, id: app.business_unit.order } + app.filter.business_unit_role.search: + parent: api_platform.doctrine.orm.search_filter + arguments: + - id: exact + uuid: exact + owner: exact + ownerUuid: exact + businessUnit.uuid: exact + businessUnit.staffs.uuid: exact + role.uuid: exact + tags: + - { name: api_platform.filter, id: app.business_unit_role.search } + + app.filter.business_unit_role.date: + parent: api_platform.doctrine.orm.date_filter + arguments: + - createdAt: ~ + updatedAt: ~ + tags: + - { name: api_platform.filter, id: app.business_unit_role.date } + + app.filter.business_unit_role.order: + parent: api_platform.doctrine.orm.order_filter + arguments: + - id: ~ + createdAt: ~ + updatedAt: ~ + owner: ~ + tags: + - { name: api_platform.filter, id: app.business_unit_role.order } + app.filter.individual.search: parent: api_platform.doctrine.orm.search_filter arguments: @@ -202,11 +256,34 @@ services: - { name: api_platform.filter, id: app.individual_persona.order } app.filter.individual_role.search: - parent: api_platform.doctrine.orm.search_filter - arguments: - - individual.uuid: exact - tags: - - { name: api_platform.filter, id: app.individual_role.search } + parent: api_platform.doctrine.orm.search_filter + arguments: + - id: exact + uuid: exact + owner: exact + ownerUuid: exact + individual.uuid: exact + role.uuid: exact + tags: + - { name: api_platform.filter, id: app.individual_role.search } + + app.filter.individual_role.date: + parent: api_platform.doctrine.orm.date_filter + arguments: + - createdAt: ~ + updatedAt: ~ + tags: + - { name: api_platform.filter, id: app.individual_role.date } + + app.filter.individual_role.order: + parent: api_platform.doctrine.orm.order_filter + arguments: + - id: ~ + createdAt: ~ + updatedAt: ~ + owner: ~ + tags: + - { name: api_platform.filter, id: app.individual_role.order } app.filter.organization.search: parent: api_platform.doctrine.orm.search_filter @@ -277,11 +354,34 @@ services: - { name: api_platform.filter, id: app.organization_persona.order } app.filter.organization_role.search: - parent: api_platform.doctrine.orm.search_filter - arguments: - - organization.uuid: exact - tags: - - { name: api_platform.filter, id: app.organization_role.search } + parent: api_platform.doctrine.orm.search_filter + arguments: + - id: exact + uuid: exact + owner: exact + ownerUuid: exact + organization.uuid: exact + role.uuid: exact + tags: + - { name: api_platform.filter, id: app.organization_role.search } + + app.filter.organization_role.date: + parent: api_platform.doctrine.orm.date_filter + arguments: + - createdAt: ~ + updatedAt: ~ + tags: + - { name: api_platform.filter, id: app.organization_role.date } + + app.filter.organization_role.order: + parent: api_platform.doctrine.orm.order_filter + arguments: + - id: ~ + createdAt: ~ + updatedAt: ~ + owner: ~ + tags: + - { name: api_platform.filter, id: app.organization_role.order } app.filter.role.search: parent: api_platform.doctrine.orm.search_filter @@ -392,11 +492,34 @@ services: - { name: api_platform.filter, id: app.staff_persona.order } app.filter.staff_role.search: - parent: api_platform.doctrine.orm.search_filter - arguments: - - staff.uuid: exact - tags: - - { name: api_platform.filter, id: app.staff_role.search } + parent: api_platform.doctrine.orm.search_filter + arguments: + - id: exact + uuid: exact + owner: exact + ownerUuid: exact + staff.uuid: exact + role.uuid: exact + tags: + - { name: api_platform.filter, id: app.staff_role.search } + + app.filter.staff_role.date: + parent: api_platform.doctrine.orm.date_filter + arguments: + - createdAt: ~ + updatedAt: ~ + tags: + - { name: api_platform.filter, id: app.staff_role.date } + + app.filter.staff_role.order: + parent: api_platform.doctrine.orm.order_filter + arguments: + - id: ~ + createdAt: ~ + updatedAt: ~ + owner: ~ + tags: + - { name: api_platform.filter, id: app.staff_role.order } app.filter.system.search: parent: api_platform.doctrine.orm.search_filter @@ -429,8 +552,31 @@ services: - { name: api_platform.filter, id: app.system.order } app.filter.system_role.search: - parent: api_platform.doctrine.orm.search_filter - arguments: - - system.uuid: exact - tags: - - { name: api_platform.filter, id: app.system_role.search } + parent: api_platform.doctrine.orm.search_filter + arguments: + - id: exact + uuid: exact + owner: exact + ownerUuid: exact + system.uuid: exact + role.uuid: exact + tags: + - { name: api_platform.filter, id: app.system_role.search } + + app.filter.system_role.date: + parent: api_platform.doctrine.orm.date_filter + arguments: + - createdAt: ~ + updatedAt: ~ + tags: + - { name: api_platform.filter, id: app.system_role.date } + + app.filter.system_role.order: + parent: api_platform.doctrine.orm.order_filter + arguments: + - id: ~ + createdAt: ~ + updatedAt: ~ + owner: ~ + tags: + - { name: api_platform.filter, id: app.system_role.order } 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/config/packages/ds_acl.yaml b/api/config/packages/ds_acl.yaml index 01cc792..bda278b 100644 --- a/api/config/packages/ds_acl.yaml +++ b/api/config/packages/ds_acl.yaml @@ -4,6 +4,7 @@ ds_acl: - App\Entity\AnonymousPersona - App\Entity\AnonymousRole - App\Entity\BusinessUnit + - App\Entity\BusinessUnitRole - App\Entity\Individual - App\Entity\IndividualPersona - App\Entity\IndividualRole @@ -47,13 +48,13 @@ ds_acl: anonymous_role_property: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.*, title: app.permissions.anonymous_role.property } anonymous_role_id: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.id, title: app.permissions.anonymous_role.id } anonymous_role_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.uuid, title: app.permissions.anonymous_role.uuid } - anonymous_role_created_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.created_at, title: app.permissions.anonymous_role.created_at } - anonymous_role_updated_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.updated_at, title: app.permissions.anonymous_role.updated_at } + anonymous_role_created_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.createdAt, title: app.permissions.anonymous_role.created_at } + anonymous_role_updated_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.updatedAt, title: app.permissions.anonymous_role.updated_at } anonymous_role_owner: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.owner, title: app.permissions.anonymous_role.owner } - anonymous_role_owner_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.owner_uuid, title: app.permissions.anonymous_role.owner_uuid } + anonymous_role_owner_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.ownerUuid, title: app.permissions.anonymous_role.owner_uuid } anonymous_role_anonymous: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.anonymous, title: app.permissions.anonymous_role.anonymous } anonymous_role_role: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.role, title: app.permissions.anonymous_role.role } - anonymous_role_business_units: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.business_units, title: app.permissions.anonymous_role.business_units } + anonymous_role_entity_uuids: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.entityUuids, title: app.permissions.anonymous_role.entity_uuids } anonymous_role_version: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.version, title: app.permissions.anonymous_role.version } anonymous_role_tenant: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.tenant, title: app.permissions.anonymous_role.tenant } business_unit: { attributes: [BROWSE, READ, EDIT, ADD, DELETE], entity: App\Entity\BusinessUnit, title: app.permissions.business_unit } @@ -68,8 +69,22 @@ ds_acl: business_unit_title: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnit.title, title: app.permissions.business_unit.title } business_unit_data: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnit.data, title: app.permissions.business_unit.data } business_unit_staffs: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnit.staffs, title: app.permissions.business_unit.staffs } + business_unit_roles: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnit.roles, title: app.permissions.business_unit.roles } business_unit_version: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnit.version, title: app.permissions.business_unit.version } business_unit_tenant: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnit.tenant, title: app.permissions.business_unit.tenant } + business_unit_role: { attributes: [BROWSE, READ, EDIT, ADD, DELETE], entity: App\Entity\BusinessUnitRole, title: app.permissions.business_unit_role } + business_unit_role_property: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnitRole.*, title: app.permissions.business_unit_role.property } + business_unit_role_id: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnitRole.id, title: app.permissions.business_unit_role.id } + business_unit_role_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnitRole.uuid, title: app.permissions.business_unit_role.uuid } + business_unit_role_created_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnitRole.createdAt, title: app.permissions.business_unit_role.created_at } + business_unit_role_updated_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnitRole.updatedAt, title: app.permissions.business_unit_role.updated_at } + business_unit_role_owner: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnitRole.owner, title: app.permissions.business_unit_role.owner } + business_unit_role_owner_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnitRole.ownerUuid, title: app.permissions.business_unit_role.owner_uuid } + business_unit_role_anonymous: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnitRole.businessUnit, title: app.permissions.business_unit_role.business_unit } + business_unit_role_role: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnitRole.role, title: app.permissions.business_unit_role.role } + business_unit_role_entity_uuids: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnitRole.entityUuids, title: app.permissions.business_unit_role.entity_uuids } + business_unit_role_version: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnitRole.version, title: app.permissions.business_unit_role.version } + business_unit_role_tenant: { attributes: [BROWSE, READ, EDIT], property: App\Entity\BusinessUnitRole.tenant, title: app.permissions.business_unit_role.tenant } individual: { attributes: [BROWSE, READ, EDIT, ADD, DELETE], entity: App\Entity\Individual, title: app.permissions.individual } individual_property: { attributes: [BROWSE, READ, EDIT], property: App\Entity\Individual.*, title: app.permissions.individual.property } individual_id: { attributes: [BROWSE, READ, EDIT], property: App\Entity\Individual.id, title: app.permissions.individual.id } @@ -100,13 +115,13 @@ ds_acl: individual_role_property: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.*, title: app.permissions.individual_role.property } individual_role_id: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.id, title: app.permissions.individual_role.id } individual_role_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.uuid, title: app.permissions.individual_role.uuid } - individual_role_created_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.created_at, title: app.permissions.individual_role.created_at } - individual_role_updated_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.updated_at, title: app.permissions.individual_role.updated_at } + individual_role_created_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.createdAt, title: app.permissions.individual_role.created_at } + individual_role_updated_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.updatedAt, title: app.permissions.individual_role.updated_at } individual_role_owner: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.owner, title: app.permissions.individual_role.owner } - individual_role_owner_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.owner_uuid, title: app.permissions.individual_role.owner_uuid } + individual_role_owner_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.ownerUuid, title: app.permissions.individual_role.owner_uuid } individual_role_individual: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.individual, title: app.permissions.individual_role.individual } individual_role_role: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.role, title: app.permissions.individual_role.role } - individual_role_business_units: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.business_units, title: app.permissions.individual_role.business_units } + individual_role_entity_uuids: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.entityUuids, title: app.permissions.individual_role.entity_uuids } individual_role_version: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.version, title: app.permissions.individual_role.version } individual_role_tenant: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.tenant, title: app.permissions.individual_role.tenant } organization: { attributes: [BROWSE, READ, EDIT, ADD, DELETE], entity: App\Entity\Organization, title: app.permissions.organization } @@ -139,13 +154,13 @@ ds_acl: organization_role_property: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.*, title: app.permissions.organization_role.property } organization_role_id: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.id, title: app.permissions.organization_role.id } organization_role_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.uuid, title: app.permissions.organization_role.uuid } - organization_role_created_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.created_at, title: app.permissions.organization_role.created_at } - organization_role_updated_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.updated_at, title: app.permissions.organization_role.updated_at } + organization_role_created_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.createdAt, title: app.permissions.organization_role.created_at } + organization_role_updated_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.updatedAt, title: app.permissions.organization_role.updated_at } organization_role_owner: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.owner, title: app.permissions.organization_role.owner } - organization_role_owner_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.owner_uuid, title: app.permissions.organization_role.owner_uuid } + organization_role_owner_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.ownerUuid, title: app.permissions.organization_role.owner_uuid } organization_role_organization: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.organization, title: app.permissions.organization_role.organization } organization_role_role: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.role, title: app.permissions.organization_role.role } - organization_role_business_units: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.business_units, title: app.permissions.organization_role.business_units } + organization_role_entity_uuids: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.entityUuids, title: app.permissions.organization_role.entity_uuids } organization_role_version: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.version, title: app.permissions.organization_role.version } organization_role_tenant: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.tenant, title: app.permissions.organization_role.tenant } role: { attributes: [BROWSE, READ, EDIT, ADD, DELETE], entity: App\Entity\Role, title: app.permissions.role } @@ -194,13 +209,13 @@ ds_acl: staff_role_property: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.*, title: app.permissions.staff_role.property } staff_role_id: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.id, title: app.permissions.staff_role.id } staff_role_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.uuid, title: app.permissions.staff_role.uuid } - staff_role_created_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.created_at, title: app.permissions.staff_role.created_at } - staff_role_updated_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.updated_at, title: app.permissions.staff_role.updated_at } + staff_role_created_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.createdAt, title: app.permissions.staff_role.created_at } + staff_role_updated_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.updatedAt, title: app.permissions.staff_role.updated_at } staff_role_owner: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.owner, title: app.permissions.staff_role.owner } - staff_role_owner_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.owner_uuid, title: app.permissions.staff_role.owner_uuid } + staff_role_owner_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.ownerUuid, title: app.permissions.staff_role.owner_uuid } staff_role_staff: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.staff, title: app.permissions.staff_role.staff } staff_role_role: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.role, title: app.permissions.staff_role.role } - staff_role_business_units: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.business_units, title: app.permissions.staff_role.business_units } + staff_role_entity_uuids: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.entityUuids, title: app.permissions.staff_role.entity_uuids } staff_role_version: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.version, title: app.permissions.staff_role.version } staff_role_tenant: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.tenant, title: app.permissions.staff_role.tenant } system: { attributes: [BROWSE, READ, EDIT, ADD, DELETE], entity: App\Entity\System, title: app.permissions.system } @@ -219,12 +234,12 @@ ds_acl: system_role_property: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.*, title: app.permissions.system_role.property } system_role_id: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.id, title: app.permissions.system_role.id } system_role_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.uuid, title: app.permissions.system_role.uuid } - system_role_created_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.created_at, title: app.permissions.system_role.created_at } - system_role_updated_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.updated_at, title: app.permissions.system_role.updated_at } + system_role_created_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.createdAt, title: app.permissions.system_role.created_at } + system_role_updated_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.updatedAt, title: app.permissions.system_role.updated_at } system_role_owner: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.owner, title: app.permissions.system_role.owner } - system_role_owner_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.owner_uuid, title: app.permissions.system_role.owner_uuid } - system_role_system: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.system, title: app.permissions.system_role.system } + system_role_owner_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.ownerUuid, title: app.permissions.system_role.owner_uuid } + system_role_system: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.system, title: app.permissions.system_role.system } system_role_role: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.role, title: app.permissions.system_role.role } - system_role_business_units: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.business_units, title: app.permissions.system_role.business_units } + system_role_entity_uuids: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.entityUuids, title: app.permissions.system_role.entity_uuids } system_role_version: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.version, title: app.permissions.system_role.version } system_role_tenant: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.tenant, title: app.permissions.system_role.tenant } diff --git a/api/config/services.yaml b/api/config/services.yaml index 8c7fea5..dcf7f79 100644 --- a/api/config/services.yaml +++ b/api/config/services.yaml @@ -40,6 +40,11 @@ services: arguments: - App\Entity\AnonymousRole + App\Repository\BusinessUnitRoleRepository: + factory: ['@doctrine.orm.default_entity_manager', getRepository] + arguments: + - App\Entity\BusinessUnitRole + App\Repository\BusinessUnitRepository: factory: ['@doctrine.orm.default_entity_manager', getRepository] arguments: diff --git a/api/config/tenant/loader/acl.yaml b/api/config/tenant/loader/acl.yaml index 6f6130c..0af652f 100644 --- a/api/config/tenant/loader/acl.yaml +++ b/api/config/tenant/loader/acl.yaml @@ -25,13 +25,11 @@ objects: - scope: type: owner entity: BusinessUnit - entity_uuid: ~ key: entity attributes: [BROWSE, READ, EDIT, ADD, DELETE] - scope: type: owner entity: BusinessUnit - entity_uuid: ~ key: property attributes: [BROWSE, READ, EDIT] - scope: diff --git a/api/config/tenant/loader/identity/staff/role.yaml b/api/config/tenant/loader/identity/staff/role.yaml index 61fd7f0..d49a5e3 100644 --- a/api/config/tenant/loader/identity/staff/role.yaml +++ b/api/config/tenant/loader/identity/staff/role.yaml @@ -7,5 +7,5 @@ prototype: owner: BusinessUnit owner_uuid: '%business_unit.administration.uuid%' role: ~ - business_units: [] + entity_uuids: [] tenant: '%tenant.uuid%' diff --git a/api/features/api/access/add.feature b/api/features/api/access/add.feature index fdae0d8..973c8be 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 19 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 5bc6b59..719ca0e 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/15239742-553e-4e56-9656-36f7c3dca7d4" 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 "15239742-553e-4e56-9656-36f7c3dca7d4" - 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 "15239742-553e-4e56-9656-36f7c3dca7d4" - 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 9ed9c4c..e635322 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/5cfeb51a-89c1-4bc9-97f7-1f57a43adbfd" 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 "5cfeb51a-89c1-4bc9-97f7-1f57a43adbfd" - 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 "5cfeb51a-89c1-4bc9-97f7-1f57a43adbfd" - 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/identity/anonymous/add.feature b/api/features/api/identity/anonymous/add.feature index 915fdfb..cd4c64e 100644 --- a/api/features/api/identity/anonymous/add.feature +++ b/api/features/api/identity/anonymous/add.feature @@ -10,6 +10,7 @@ Feature: Add anonymous identities And I send a "POST" request to "/anonymouses" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "BusinessUnit", "ownerUuid": "325e1004-8516-4ca9-a4d3-d7505bd9a7fe", "roles": [], @@ -23,6 +24,7 @@ Feature: Add anonymous identities And the JSON node "id" should be equal to the number 3 And the JSON node "uuid" should exist And the JSON node "createdAt" should exist + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should exist And the JSON node "deletedAt" should exist And the JSON node "owner" should exist diff --git a/api/features/api/identity/anonymous/edit.feature b/api/features/api/identity/anonymous/edit.feature index 063b63a..094ece4 100644 --- a/api/features/api/identity/anonymous/edit.feature +++ b/api/features/api/identity/anonymous/edit.feature @@ -10,6 +10,7 @@ Feature: Edit anonymous identities And I send a "PUT" request to "/anonymouses/ad1a4ee4-b707-4135-b8e9-498286d5830c" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "BusinessUnit", "ownerUuid": "e51aea66-ba28-4718-9644-e5fc35ad7a45", "roles": [], @@ -19,6 +20,7 @@ Feature: Edit anonymous identities 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 "BusinessUnit" And the JSON node "ownerUuid" should be equal to the string "e51aea66-ba28-4718-9644-e5fc35ad7a45" And the JSON node "roles" should exist @@ -31,6 +33,7 @@ Feature: Edit anonymous identities 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 "BusinessUnit" And the JSON node "ownerUuid" should be equal to the string "e51aea66-ba28-4718-9644-e5fc35ad7a45" And the JSON node "roles" should exist @@ -45,7 +48,6 @@ Feature: Edit anonymous identities { "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" @@ -56,7 +58,6 @@ Feature: Edit anonymous identities 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 "ad1a4ee4-b707-4135-b8e9-498286d5830c" - 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" @@ -68,7 +69,6 @@ Feature: Edit anonymous identities 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 "ad1a4ee4-b707-4135-b8e9-498286d5830c" - 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/identity/individual/add.feature b/api/features/api/identity/individual/add.feature index bd6b91e..26b0c94 100644 --- a/api/features/api/identity/individual/add.feature +++ b/api/features/api/identity/individual/add.feature @@ -10,6 +10,7 @@ Feature: Add individual identities And I send a "POST" request to "/individuals" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "BusinessUnit", "ownerUuid": "83bf8f26-7181-4bed-92f3-3ce5e4c286d7", "roles": [], @@ -23,6 +24,7 @@ Feature: Add individual identities And the JSON node "id" should be equal to the number 3 And the JSON node "uuid" should exist And the JSON node "createdAt" should exist + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should exist And the JSON node "deletedAt" should exist And the JSON node "owner" should exist diff --git a/api/features/api/identity/individual/edit.feature b/api/features/api/identity/individual/edit.feature index ac285f9..441cc56 100644 --- a/api/features/api/identity/individual/edit.feature +++ b/api/features/api/identity/individual/edit.feature @@ -10,6 +10,7 @@ Feature: Edit individual identities And I send a "PUT" request to "/individuals/9ce3bdb9-47e1-43c9-81ee-0dcc2106ba42" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "BusinessUnit", "ownerUuid": "e51aea66-ba28-4718-9644-e5fc35ad7a45", "roles": [], @@ -19,6 +20,7 @@ Feature: Edit individual identities 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 "BusinessUnit" And the JSON node "ownerUuid" should be equal to the string "e51aea66-ba28-4718-9644-e5fc35ad7a45" And the JSON node "roles" should exist @@ -31,6 +33,7 @@ Feature: Edit individual identities 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 "BusinessUnit" And the JSON node "ownerUuid" should be equal to the string "e51aea66-ba28-4718-9644-e5fc35ad7a45" And the JSON node "roles" should exist @@ -45,7 +48,6 @@ Feature: Edit individual identities { "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" @@ -56,7 +58,6 @@ Feature: Edit individual identities 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 "9ce3bdb9-47e1-43c9-81ee-0dcc2106ba42" - 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" @@ -68,7 +69,6 @@ Feature: Edit individual identities 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 "9ce3bdb9-47e1-43c9-81ee-0dcc2106ba42" - 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/identity/organization/add.feature b/api/features/api/identity/organization/add.feature index fd326ff..c77d69a 100644 --- a/api/features/api/identity/organization/add.feature +++ b/api/features/api/identity/organization/add.feature @@ -10,6 +10,7 @@ Feature: Add organization identities And I send a "POST" request to "/organizations" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "BusinessUnit", "ownerUuid": "83bf8f26-7181-4bed-92f3-3ce5e4c286d7", "roles": [], @@ -23,6 +24,7 @@ Feature: Add organization identities And the JSON node "id" should be equal to the number 3 And the JSON node "uuid" should exist And the JSON node "createdAt" should exist + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should exist And the JSON node "deletedAt" should exist And the JSON node "owner" should exist diff --git a/api/features/api/identity/organization/edit.feature b/api/features/api/identity/organization/edit.feature index e21de4a..9dab869 100644 --- a/api/features/api/identity/organization/edit.feature +++ b/api/features/api/identity/organization/edit.feature @@ -10,6 +10,7 @@ Feature: Edit organization identities And I send a "PUT" request to "/organizations/a6b3a00b-e732-4aeb-8011-a1e58fc7b5e3" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "BusinessUnit", "ownerUuid": "e51aea66-ba28-4718-9644-e5fc35ad7a45", "roles": [], @@ -19,6 +20,7 @@ Feature: Edit organization identities 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 "BusinessUnit" And the JSON node "ownerUuid" should be equal to the string "e51aea66-ba28-4718-9644-e5fc35ad7a45" And the JSON node "roles" should exist @@ -31,6 +33,7 @@ Feature: Edit organization identities 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 "BusinessUnit" And the JSON node "ownerUuid" should be equal to the string "e51aea66-ba28-4718-9644-e5fc35ad7a45" And the JSON node "roles" should exist @@ -45,7 +48,6 @@ Feature: Edit organization identities { "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" @@ -56,7 +58,6 @@ Feature: Edit organization identities 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 "a6b3a00b-e732-4aeb-8011-a1e58fc7b5e3" - 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" @@ -68,7 +69,6 @@ Feature: Edit organization identities 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 "a6b3a00b-e732-4aeb-8011-a1e58fc7b5e3" - 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/identity/staff/add.feature b/api/features/api/identity/staff/add.feature index 5dd7044..e961926 100644 --- a/api/features/api/identity/staff/add.feature +++ b/api/features/api/identity/staff/add.feature @@ -10,6 +10,7 @@ Feature: Add staff identities And I send a "POST" request to "/staffs" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "BusinessUnit", "ownerUuid": "83bf8f26-7181-4bed-92f3-3ce5e4c286d7", "roles": [], @@ -23,6 +24,7 @@ Feature: Add staff identities And the JSON node "id" should be equal to the number 3 And the JSON node "uuid" should exist And the JSON node "createdAt" should exist + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should exist And the JSON node "deletedAt" should exist And the JSON node "owner" should exist diff --git a/api/features/api/identity/staff/edit.feature b/api/features/api/identity/staff/edit.feature index e0b643e..234d651 100644 --- a/api/features/api/identity/staff/edit.feature +++ b/api/features/api/identity/staff/edit.feature @@ -10,6 +10,7 @@ Feature: Edit staff identities And I send a "PUT" request to "/staffs/06f8bb0b-45e3-46af-94c7-ff917f720c82" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "BusinessUnit", "ownerUuid": "e51aea66-ba28-4718-9644-e5fc35ad7a45", "roles": [], @@ -19,6 +20,7 @@ Feature: Edit staff identities 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 "BusinessUnit" And the JSON node "ownerUuid" should be equal to the string "e51aea66-ba28-4718-9644-e5fc35ad7a45" And the JSON node "roles" should exist @@ -31,6 +33,7 @@ Feature: Edit staff identities 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 "BusinessUnit" And the JSON node "ownerUuid" should be equal to the string "e51aea66-ba28-4718-9644-e5fc35ad7a45" And the JSON node "roles" should exist @@ -45,7 +48,6 @@ Feature: Edit staff identities { "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" @@ -56,7 +58,6 @@ Feature: Edit staff identities 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 "06f8bb0b-45e3-46af-94c7-ff917f720c82" - 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" @@ -68,7 +69,6 @@ Feature: Edit staff identities 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 "06f8bb0b-45e3-46af-94c7-ff917f720c82" - 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/identity/system/add.feature b/api/features/api/identity/system/add.feature index 402ea34..e27313f 100644 --- a/api/features/api/identity/system/add.feature +++ b/api/features/api/identity/system/add.feature @@ -10,6 +10,7 @@ Feature: Add system identities And I send a "POST" request to "/systems" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "BusinessUnit", "ownerUuid": "325e1004-8516-4ca9-a4d3-d7505bd9a7fe", "roles": [], @@ -23,6 +24,7 @@ Feature: Add system identities And the JSON node "id" should be equal to the number 3 And the JSON node "uuid" should exist And the JSON node "createdAt" should exist + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should exist And the JSON node "deletedAt" should exist And the JSON node "owner" should exist diff --git a/api/features/api/identity/system/edit.feature b/api/features/api/identity/system/edit.feature index 0ef949e..99670f0 100644 --- a/api/features/api/identity/system/edit.feature +++ b/api/features/api/identity/system/edit.feature @@ -10,6 +10,7 @@ Feature: Edit system identities And I send a "PUT" request to "/systems/aa18b644-a503-49fa-8f53-10f4c1f8e3a1" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "BusinessUnit", "ownerUuid": "ca28a28a-fd23-4d9b-9331-963bfaa140ec", "roles": [], @@ -19,6 +20,7 @@ Feature: Edit system identities 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 "BusinessUnit" And the JSON node "ownerUuid" should be equal to the string "ca28a28a-fd23-4d9b-9331-963bfaa140ec" And the JSON node "roles" should exist @@ -31,6 +33,7 @@ Feature: Edit system identities 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 "BusinessUnit" And the JSON node "ownerUuid" should be equal to the string "ca28a28a-fd23-4d9b-9331-963bfaa140ec" And the JSON node "roles" should exist @@ -45,7 +48,6 @@ Feature: Edit system identities { "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" @@ -56,7 +58,6 @@ Feature: Edit system identities 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 "aa18b644-a503-49fa-8f53-10f4c1f8e3a1" - 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" @@ -68,7 +69,6 @@ Feature: Edit system identities 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 "aa18b644-a503-49fa-8f53-10f4c1f8e3a1" - 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/metadata/add.feature b/api/features/api/metadata/add.feature index b5fc857..f67bf2c 100644 --- a/api/features/api/metadata/add.feature +++ b/api/features/api/metadata/add.feature @@ -10,6 +10,7 @@ Feature: Add metadata And I send a "POST" request to "/metadata" with body: """ { + "createdAt": "2000-01-01 12:00:00", "owner": "BusinessUnit", "ownerUuid": "325e1004-8516-4ca9-a4d3-d7505bd9a7fe", "title": { @@ -31,6 +32,7 @@ Feature: Add metadata And the JSON node "id" should be equal to the number 3 And the JSON node "uuid" should exist And the JSON node "createdAt" should exist + And the JSON node "createdAt" should be equal to the string "2000-01-01T12:00:00+00:00" And the JSON node "updatedAt" should exist And the JSON node "deletedAt" should exist And the JSON node "owner" should exist diff --git a/api/features/api/metadata/edit.feature b/api/features/api/metadata/edit.feature index dc8b319..6475de2 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/790d4acc-0651-49c2-8518-c4839a2ec801" 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 "790d4acc-0651-49c2-8518-c4839a2ec801" - 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 "790d4acc-0651-49c2-8518-c4839a2ec801" - 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/system/tenant/add.feature b/api/features/api/system/tenant/add.feature index ae37de8..5fe9bc2 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 diff --git a/api/src/Entity/Anonymous.php b/api/src/Entity/Anonymous.php index d05106a..a124905 100644 --- a/api/src/Entity/Anonymous.php +++ b/api/src/Entity/Anonymous.php @@ -83,8 +83,9 @@ class Anonymous implements Identifiable, Uuidentifiable, Ownable, Identitiable, /** * @var \DateTime - * @ApiProperty(writable=false) - * @Serializer\Groups({"anonymous_output"}) + * @ApiProperty + * @Serializer\Groups({"anonymous_output", "anonymous_input"}) + * @Assert\DateTime */ protected $createdAt; diff --git a/api/src/Entity/AnonymousRole.php b/api/src/Entity/AnonymousRole.php index 7fe567f..afe4dea 100644 --- a/api/src/Entity/AnonymousRole.php +++ b/api/src/Entity/AnonymousRole.php @@ -3,7 +3,6 @@ namespace App\Entity; use App\Entity\Attribute\Accessor; -use Doctrine\Common\Collections\ArrayCollection; use ApiPlatform\Core\Annotation\ApiResource; use ApiPlatform\Core\Annotation\ApiProperty; @@ -18,10 +17,10 @@ * @ApiResource( * attributes={ * "normalization_context"={ - * "groups"={"business_unit_role_output"} + * "groups"={"assigned_role_output"} * }, * "denormalization_context"={ - * "groups"={"business_unit_role_input"} + * "groups"={"assigned_role_input"} * }, * "filters"={ * "app.anonymous_role.search", @@ -35,42 +34,18 @@ * @ORM\Cache(usage="NONSTRICT_READ_WRITE") * @ORMAssert\UniqueEntity(fields="uuid") */ -class AnonymousRole extends BusinessUnitRole +class AnonymousRole extends AssignedRole { use Accessor\Anonymous; - use Accessor\BusinessUnits; /** * @var \App\Entity\Anonymous * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) + * @Serializer\Groups({"assigned_role_output", "assigned_role_input"}) * @ORM\ManyToOne(targetEntity="App\Entity\Anonymous", inversedBy="roles") * @ORM\JoinColumn(name="anonymous_id", referencedColumnName="id") * @ORM\Cache(usage="NONSTRICT_READ_WRITE") * @Assert\Valid */ private $anonymous; - - /** - * @var \Doctrine\Common\Collections\Collection - * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) - * @ORM\ManyToMany(targetEntity="App\Entity\BusinessUnit", cascade={"remove", "persist"}) - * @ORM\JoinTable( - * name="app_anonymous_role_bu", - * joinColumns={ - * @ORM\JoinColumn(name="anonymous_role_id", referencedColumnName="id") - * } - * ) - * @ORM\Cache(usage="NONSTRICT_READ_WRITE") - */ - private $businessUnits; - - /** - * Constructor - */ - public function __construct() - { - $this->businessUnits = new ArrayCollection; - } } diff --git a/api/src/Entity/AssignedRole.php b/api/src/Entity/AssignedRole.php new file mode 100644 index 0000000..147940c --- /dev/null +++ b/api/src/Entity/AssignedRole.php @@ -0,0 +1,136 @@ +entityUuids = []; + } +} diff --git a/api/src/Entity/Attribute/Accessor/Roles.php b/api/src/Entity/Attribute/Accessor/Roles.php index 8931b7d..98f1aca 100644 --- a/api/src/Entity/Attribute/Accessor/Roles.php +++ b/api/src/Entity/Attribute/Accessor/Roles.php @@ -2,7 +2,7 @@ namespace App\Entity\Attribute\Accessor; -use App\Entity\BusinessUnitRole; +use App\Entity\AssignedRole; /** * Trait Roles @@ -12,10 +12,10 @@ trait Roles /** * Add role * - * @param \App\Entity\BusinessUnitRole $role + * @param \App\Entity\AssignedRole $role * @return object */ - public function addRole(BusinessUnitRole $role) + public function addRole(AssignedRole $role) { if (!$this->roles->contains($role)) { $this->roles->add($role); @@ -27,10 +27,10 @@ public function addRole(BusinessUnitRole $role) /** * Remove role * - * @param \App\Entity\BusinessUnitRole $role + * @param \App\Entity\AssignedRole $role * @return object */ - public function removeRole(BusinessUnitRole $role) + public function removeRole(AssignedRole $role) { if ($this->roles->contains($role)) { $this->roles->removeElement($role); diff --git a/api/src/Entity/BusinessUnit.php b/api/src/Entity/BusinessUnit.php index de64652..423cb0e 100644 --- a/api/src/Entity/BusinessUnit.php +++ b/api/src/Entity/BusinessUnit.php @@ -63,7 +63,6 @@ class BusinessUnit implements Identifiable, Uuidentifiable, Ownable, Translatabl use TranslationAccessor\Title; use Accessor\Data; use EntityAccessor\Staffs; - use EntityAccessor\Individuals; use Accessor\Deleted; use Accessor\Version; use TenantAccessor\Tenant; @@ -89,8 +88,9 @@ class BusinessUnit implements Identifiable, Uuidentifiable, Ownable, Translatabl /** * @var \DateTime - * @ApiProperty(writable=false) - * @Serializer\Groups({"business_unit_output"}) + * @ApiProperty + * @Serializer\Groups({"business_unit_output", "business_unit_input"}) + * @Assert\DateTime */ protected $createdAt; @@ -161,12 +161,13 @@ class BusinessUnit implements Identifiable, Uuidentifiable, Ownable, Translatabl private $staffs; /** - * @var \Doctrine\Common\Collections\Collection + * @var \Doctrine\Common\Collections\ArrayCollection * @ApiProperty(writable=false) - * @ORM\ManyToMany(targetEntity="Individual", mappedBy="businessUnits") + * @Serializer\Groups({"business_unit_output"}) + * @ORM\OneToMany(targetEntity="BusinessUnitRole", mappedBy="businessUnit", cascade={"persist", "remove"}) * @ORM\Cache(usage="NONSTRICT_READ_WRITE") */ - private $individuals; + private $roles; /** * @var integer @@ -196,6 +197,6 @@ public function __construct() $this->title = []; $this->data = []; $this->staffs = new ArrayCollection; - $this->individuals = new ArrayCollection; + $this->roles = new ArrayCollection; } } diff --git a/api/src/Entity/BusinessUnitRole.php b/api/src/Entity/BusinessUnitRole.php index 6852140..7fff560 100644 --- a/api/src/Entity/BusinessUnitRole.php +++ b/api/src/Entity/BusinessUnitRole.php @@ -2,15 +2,7 @@ namespace App\Entity; -use App\Entity\Attribute\Accessor as EntityAccessor; -use Ds\Component\Model\Attribute\Accessor; -use Ds\Component\Model\Type\Identifiable; -use Ds\Component\Model\Type\Ownable; -use Ds\Component\Model\Type\Uuidentifiable; -use Ds\Component\Model\Type\Versionable; -use Ds\Component\Tenant\Model\Attribute\Accessor as TenantAccessor; -use Ds\Component\Tenant\Model\Type\Tenantable; -use Knp\DoctrineBehaviors\Model as Behavior; +use App\Entity\Attribute\Accessor; use ApiPlatform\Core\Annotation\ApiResource; use ApiPlatform\Core\Annotation\ApiProperty; @@ -21,99 +13,39 @@ /** * Class BusinessUnitRole + * + * @ApiResource( + * attributes={ + * "normalization_context"={ + * "groups"={"assigned_role_output"} + * }, + * "denormalization_context"={ + * "groups"={"assigned_role_input"} + * }, + * "filters"={ + * "app.business_unit_role.search", + * "app.business_unit_role.date", + * "app.business_unit_role.order" + * } + * } + * ) + * @ORM\Entity(repositoryClass="App\Repository\BusinessUnitRoleRepository") + * @ORM\Table(name="app_bu_role") + * @ORM\Cache(usage="NONSTRICT_READ_WRITE") + * @ORMAssert\UniqueEntity(fields="uuid") */ -abstract class BusinessUnitRole implements Identifiable, Uuidentifiable, Ownable, Versionable, Tenantable +class BusinessUnitRole extends AssignedRole { - use Behavior\Timestampable\Timestampable; - - use Accessor\Id; - use Accessor\Uuid; - use Accessor\Owner; - use Accessor\OwnerUuid; - use EntityAccessor\Role; - use Accessor\Version; - use TenantAccessor\Tenant; - - /** - * @var integer - * @ApiProperty(identifier=false, writable=false) - * @Serializer\Groups({"business_unit_role_output"}) - * @ORM\Id - * @ORM\GeneratedValue(strategy="AUTO") - * @ORM\Column(name="id", type="integer") - */ - protected $id; - - /** - * @var string - * @ApiProperty(identifier=true, writable=false) - * @Serializer\Groups({"business_unit_role_output"}) - * @ORM\Column(name="uuid", type="guid", unique=true) - * @Assert\Uuid - */ - protected $uuid; - - /** - * @var \DateTime - * @ApiProperty(writable=false) - * @Serializer\Groups({"business_unit_role_output"}) - */ - protected $createdAt; - - /** - * @var \DateTime - * @ApiProperty(writable=false) - * @Serializer\Groups({"business_unit_role_output"}) - */ - protected $updatedAt; - - /** - * @var string - * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) - * @ORM\Column(name="`owner`", type="string", length=255, nullable=true) - * @Assert\NotBlank - */ - protected $owner; - - /** - * @var string - * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) - * @ORM\Column(name="owner_uuid", type="guid", nullable=true) - * @Assert\NotBlank - * @Assert\Uuid - */ - protected $ownerUuid; + use Accessor\BusinessUnit; /** - * @var \App\Entity\Role + * @var \App\Entity\BusinessUnit * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) - * @ORM\ManyToOne(targetEntity="App\Entity\Role") - * @ORM\JoinColumn(name="role_id", referencedColumnName="id") + * @Serializer\Groups({"assigned_role_output", "assigned_role_input"}) + * @ORM\ManyToOne(targetEntity="App\Entity\BusinessUnit", inversedBy="roles") + * @ORM\JoinColumn(name="business_unit_id", referencedColumnName="id") * @ORM\Cache(usage="NONSTRICT_READ_WRITE") * @Assert\Valid */ - protected $role; - - /** - * @var integer - * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) - * @ORM\Column(name="version", type="integer") - * @ORM\Version - * @Assert\NotBlank - * @Assert\Type("integer") - */ - protected $version; - - /** - * @var string - * @ApiProperty(writable=false) - * @Serializer\Groups({"business_unit_role_output"}) - * @ORM\Column(name="tenant", type="guid") - * @Assert\Uuid - */ - protected $tenant; + private $businessUnit; } diff --git a/api/src/Entity/Individual.php b/api/src/Entity/Individual.php index 5f81c6b..444631f 100644 --- a/api/src/Entity/Individual.php +++ b/api/src/Entity/Individual.php @@ -83,8 +83,9 @@ class Individual implements Identifiable, Uuidentifiable, Ownable, Identitiable, /** * @var \DateTime - * @ApiProperty(writable=false) - * @Serializer\Groups({"individual_output"}) + * @ApiProperty + * @Serializer\Groups({"individual_output", "individual_input"}) + * @Assert\DateTime */ protected $createdAt; diff --git a/api/src/Entity/IndividualRole.php b/api/src/Entity/IndividualRole.php index 1e95bf3..ddc9300 100644 --- a/api/src/Entity/IndividualRole.php +++ b/api/src/Entity/IndividualRole.php @@ -3,7 +3,6 @@ namespace App\Entity; use App\Entity\Attribute\Accessor; -use Doctrine\Common\Collections\ArrayCollection; use ApiPlatform\Core\Annotation\ApiResource; use ApiPlatform\Core\Annotation\ApiProperty; @@ -18,10 +17,10 @@ * @ApiResource( * attributes={ * "normalization_context"={ - * "groups"={"business_unit_role_output"} + * "groups"={"assigned_role_output"} * }, * "denormalization_context"={ - * "groups"={"business_unit_role_input"} + * "groups"={"assigned_role_input"} * }, * "filters"={ * "app.individual_role.search", @@ -35,42 +34,18 @@ * @ORM\Cache(usage="NONSTRICT_READ_WRITE") * @ORMAssert\UniqueEntity(fields="uuid") */ -class IndividualRole extends BusinessUnitRole +class IndividualRole extends AssignedRole { use Accessor\Individual; - use Accessor\BusinessUnits; /** * @var \App\Entity\Individual * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) + * @Serializer\Groups({"assigned_role_output", "assigned_role_input"}) * @ORM\ManyToOne(targetEntity="App\Entity\Individual", inversedBy="roles") * @ORM\JoinColumn(name="individual_id", referencedColumnName="id") * @ORM\Cache(usage="NONSTRICT_READ_WRITE") * @Assert\Valid */ private $individual; - - /** - * @var \Doctrine\Common\Collections\Collection - * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) - * @ORM\ManyToMany(targetEntity="App\Entity\BusinessUnit", cascade={"remove", "persist"}) - * @ORM\JoinTable( - * name="app_individual_role_bu", - * joinColumns={ - * @ORM\JoinColumn(name="individual_role_id", referencedColumnName="id") - * } - * ) - * @ORM\Cache(usage="NONSTRICT_READ_WRITE") - */ - private $businessUnits; - - /** - * Constructor - */ - public function __construct() - { - $this->businessUnits = new ArrayCollection; - } } diff --git a/api/src/Entity/Organization.php b/api/src/Entity/Organization.php index 292c139..c237a51 100644 --- a/api/src/Entity/Organization.php +++ b/api/src/Entity/Organization.php @@ -83,8 +83,9 @@ class Organization implements Identifiable, Uuidentifiable, Ownable, Identitiabl /** * @var \DateTime - * @ApiProperty(writable=false) - * @Serializer\Groups({"organization_output"}) + * @ApiProperty + * @Serializer\Groups({"organization_output", "organization_input"}) + * @Assert\DateTime */ protected $createdAt; diff --git a/api/src/Entity/OrganizationRole.php b/api/src/Entity/OrganizationRole.php index 28e0711..6332974 100644 --- a/api/src/Entity/OrganizationRole.php +++ b/api/src/Entity/OrganizationRole.php @@ -3,7 +3,6 @@ namespace App\Entity; use App\Entity\Attribute\Accessor; -use Doctrine\Common\Collections\ArrayCollection; use ApiPlatform\Core\Annotation\ApiResource; use ApiPlatform\Core\Annotation\ApiProperty; @@ -18,10 +17,10 @@ * @ApiResource( * attributes={ * "normalization_context"={ - * "groups"={"business_unit_role_output"} + * "groups"={"assigned_role_output"} * }, * "denormalization_context"={ - * "groups"={"business_unit_role_input"} + * "groups"={"assigned_role_input"} * }, * "filters"={ * "app.organization_role.search", @@ -35,42 +34,18 @@ * @ORM\Cache(usage="NONSTRICT_READ_WRITE") * @ORMAssert\UniqueEntity(fields="uuid") */ -class OrganizationRole extends BusinessUnitRole +class OrganizationRole extends AssignedRole { use Accessor\Organization; - use Accessor\BusinessUnits; /** * @var \App\Entity\Organization * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) + * @Serializer\Groups({"assigned_role_output", "assigned_role_input"}) * @ORM\ManyToOne(targetEntity="App\Entity\Organization", inversedBy="roles") * @ORM\JoinColumn(name="organization_id", referencedColumnName="id") * @ORM\Cache(usage="NONSTRICT_READ_WRITE") * @Assert\Valid */ private $organization; - - /** - * @var \Doctrine\Common\Collections\Collection - * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) - * @ORM\ManyToMany(targetEntity="App\Entity\BusinessUnit", cascade={"remove", "persist"}) - * @ORM\JoinTable( - * name="app_organization_role_bu", - * joinColumns={ - * @ORM\JoinColumn(name="organization_role_id", referencedColumnName="id") - * } - * ) - * @ORM\Cache(usage="NONSTRICT_READ_WRITE") - */ - private $businessUnits; - - /** - * Constructor - */ - public function __construct() - { - $this->businessUnits = new ArrayCollection; - } } diff --git a/api/src/Entity/Persona.php b/api/src/Entity/Persona.php index 8301f4b..8ec0d2f 100644 --- a/api/src/Entity/Persona.php +++ b/api/src/Entity/Persona.php @@ -68,8 +68,9 @@ abstract class Persona implements Identifiable, Uuidentifiable, Ownable, Identit /** * @var \DateTime - * @ApiProperty(writable=false) - * @Serializer\Groups({"persona_output"}) + * @ApiProperty + * @Serializer\Groups({"persona_output", "persona_input"}) + * @Assert\DateTime */ protected $createdAt; diff --git a/api/src/Entity/Role.php b/api/src/Entity/Role.php index 16c0baf..9910a4b 100644 --- a/api/src/Entity/Role.php +++ b/api/src/Entity/Role.php @@ -95,8 +95,9 @@ class Role implements Identifiable, Uuidentifiable, Sluggable, Ownable, Translat /** * @var \DateTime - * @ApiProperty(writable=false) - * @Serializer\Groups({"role_output"}) + * @ApiProperty + * @Serializer\Groups({"role_output", "role_input"}) + * @Assert\DateTime */ protected $createdAt; diff --git a/api/src/Entity/Staff.php b/api/src/Entity/Staff.php index b1eefe7..c953b83 100644 --- a/api/src/Entity/Staff.php +++ b/api/src/Entity/Staff.php @@ -85,8 +85,9 @@ class Staff implements Identifiable, Uuidentifiable, Ownable, Identitiable, Dele /** * @var \DateTime - * @ApiProperty(writable=false) - * @Serializer\Groups({"staff_output"}) + * @ApiProperty + * @Serializer\Groups({"staff_output", "staff_input"}) + * @Assert\DateTime */ protected $createdAt; diff --git a/api/src/Entity/StaffRole.php b/api/src/Entity/StaffRole.php index 61211f3..f7aae3d 100644 --- a/api/src/Entity/StaffRole.php +++ b/api/src/Entity/StaffRole.php @@ -3,7 +3,6 @@ namespace App\Entity; use App\Entity\Attribute\Accessor; -use Doctrine\Common\Collections\ArrayCollection; use ApiPlatform\Core\Annotation\ApiResource; use ApiPlatform\Core\Annotation\ApiProperty; @@ -18,10 +17,10 @@ * @ApiResource( * attributes={ * "normalization_context"={ - * "groups"={"business_unit_role_output"} + * "groups"={"assigned_role_output"} * }, * "denormalization_context"={ - * "groups"={"business_unit_role_input"} + * "groups"={"assigned_role_input"} * }, * "filters"={ * "app.staff_role.search", @@ -35,42 +34,18 @@ * @ORM\Cache(usage="NONSTRICT_READ_WRITE") * @ORMAssert\UniqueEntity(fields="uuid") */ -class StaffRole extends BusinessUnitRole +class StaffRole extends AssignedRole { use Accessor\Staff; - use Accessor\BusinessUnits; /** * @var \App\Entity\Staff * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) + * @Serializer\Groups({"assigned_role_output", "assigned_role_input"}) * @ORM\ManyToOne(targetEntity="App\Entity\Staff", inversedBy="roles") * @ORM\JoinColumn(name="staff_id", referencedColumnName="id") * @ORM\Cache(usage="NONSTRICT_READ_WRITE") * @Assert\Valid */ private $staff; - - /** - * @var \Doctrine\Common\Collections\Collection - * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) - * @ORM\ManyToMany(targetEntity="App\Entity\BusinessUnit", cascade={"remove", "persist"}) - * @ORM\JoinTable( - * name="app_staff_role_bu", - * joinColumns={ - * @ORM\JoinColumn(name="staff_role_id", referencedColumnName="id") - * } - * ) - * @ORM\Cache(usage="NONSTRICT_READ_WRITE") - */ - private $businessUnits; - - /** - * Constructor - */ - public function __construct() - { - $this->businessUnits = new ArrayCollection; - } } diff --git a/api/src/Entity/System.php b/api/src/Entity/System.php index d2ce8e8..a133dbc 100644 --- a/api/src/Entity/System.php +++ b/api/src/Entity/System.php @@ -79,8 +79,9 @@ class System implements Identifiable, Uuidentifiable, Ownable, Deletable, Versio /** * @var \DateTime - * @ApiProperty(writable=false) - * @Serializer\Groups({"system_output"}) + * @ApiProperty + * @Serializer\Groups({"system_output", "system_input"}) + * @Assert\DateTime */ protected $createdAt; diff --git a/api/src/Entity/SystemRole.php b/api/src/Entity/SystemRole.php index 930489c..54b96e6 100644 --- a/api/src/Entity/SystemRole.php +++ b/api/src/Entity/SystemRole.php @@ -3,7 +3,6 @@ namespace App\Entity; use App\Entity\Attribute\Accessor; -use Doctrine\Common\Collections\ArrayCollection; use ApiPlatform\Core\Annotation\ApiResource; use ApiPlatform\Core\Annotation\ApiProperty; @@ -18,10 +17,10 @@ * @ApiResource( * attributes={ * "normalization_context"={ - * "groups"={"business_unit_role_output"} + * "groups"={"assigned_role_output"} * }, * "denormalization_context"={ - * "groups"={"business_unit_role_input"} + * "groups"={"assigned_role_input"} * }, * "filters"={ * "app.system_role.search", @@ -35,42 +34,18 @@ * @ORM\Cache(usage="NONSTRICT_READ_WRITE") * @ORMAssert\UniqueEntity(fields="uuid") */ -class SystemRole extends BusinessUnitRole +class SystemRole extends AssignedRole { use Accessor\System; - use Accessor\BusinessUnits; /** * @var \App\Entity\System * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) + * @Serializer\Groups({"assigned_role_output", "assigned_role_input"}) * @ORM\ManyToOne(targetEntity="App\Entity\System", inversedBy="roles") * @ORM\JoinColumn(name="system_id", referencedColumnName="id") * @ORM\Cache(usage="NONSTRICT_READ_WRITE") * @Assert\Valid */ private $system; - - /** - * @var \Doctrine\Common\Collections\Collection - * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) - * @ORM\ManyToMany(targetEntity="App\Entity\BusinessUnit", cascade={"remove", "persist"}) - * @ORM\JoinTable( - * name="app_system_role_bu", - * joinColumns={ - * @ORM\JoinColumn(name="system_role_id", referencedColumnName="id") - * } - * ) - * @ORM\Cache(usage="NONSTRICT_READ_WRITE") - */ - private $businessUnits; - - /** - * Constructor - */ - public function __construct() - { - $this->businessUnits = new ArrayCollection; - } } diff --git a/api/src/Fixture/Anonymous.php b/api/src/Fixture/Anonymous.php index 058b779..9d439e7 100644 --- a/api/src/Fixture/Anonymous.php +++ b/api/src/Fixture/Anonymous.php @@ -3,6 +3,7 @@ namespace App\Fixture; use App\Entity\Anonymous as AnonymousEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; @@ -32,6 +33,13 @@ public function load(ObjectManager $manager) ->setOwner($object->owner) ->setOwnerUuid($object->owner_uuid) ->setTenant($object->tenant); + + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $anonymous->setCreatedAt($date); + } + $manager->persist($anonymous); $this->setReference($object->uuid, $anonymous); } diff --git a/api/src/Fixture/AnonymousPersona.php b/api/src/Fixture/AnonymousPersona.php index 09cefa2..9ac2378 100644 --- a/api/src/Fixture/AnonymousPersona.php +++ b/api/src/Fixture/AnonymousPersona.php @@ -3,6 +3,7 @@ namespace App\Fixture; use App\Entity\AnonymousPersona as AnonymousPersonaEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; use LogicException; @@ -42,6 +43,13 @@ public function load(ObjectManager $manager) ->setTitle((array) $object->title) ->setData((array) $object->data) ->setTenant($object->tenant); + + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $persona->setCreatedAt($date); + } + $manager->persist($persona); } diff --git a/api/src/Fixture/AnonymousRole.php b/api/src/Fixture/AnonymousRole.php index 69c86af..c1b0a6e 100644 --- a/api/src/Fixture/AnonymousRole.php +++ b/api/src/Fixture/AnonymousRole.php @@ -3,6 +3,7 @@ namespace App\Fixture; use App\Entity\AnonymousRole as AnonymousRoleEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; use LogicException; @@ -39,8 +40,15 @@ public function load(ObjectManager $manager) ->setUuid($object->uuid) ->setOwner($object->owner) ->setOwnerUuid($object->owner_uuid) + ->setEntityUuids((array) $object->entity_uuids) ->setTenant($object->tenant); + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $anonymousRole->setCreatedAt($date); + } + $role = $this->getReference($object->role); if (!$role) { @@ -48,17 +56,6 @@ public function load(ObjectManager $manager) } $anonymousRole->setRole($role); - - foreach ($object->business_units as $uuid) { - $businessUnit = $this->getReference($uuid); - - if (!$businessUnit) { - throw new LogicException('Business Unit "'.$uuid.'" does not exist.'); - } - - $anonymousRole->addBusinessUnit($businessUnit); - } - $manager->persist($anonymousRole); } diff --git a/api/src/Fixture/BusinessUnit.php b/api/src/Fixture/BusinessUnit.php index 2de7f7e..5fc62ce 100644 --- a/api/src/Fixture/BusinessUnit.php +++ b/api/src/Fixture/BusinessUnit.php @@ -3,6 +3,7 @@ namespace App\Fixture; use App\Entity\BusinessUnit as BusinessUnitEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; @@ -34,6 +35,13 @@ public function load(ObjectManager $manager) ->setTitle((array) $object->title) ->setData((array) $object->data) ->setTenant($object->tenant); + + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $businessUnit->setCreatedAt($date); + } + $manager->persist($businessUnit); $this->setReference($object->uuid, $businessUnit); } diff --git a/api/src/Fixture/BusinessUnitRole.php b/api/src/Fixture/BusinessUnitRole.php new file mode 100644 index 0000000..db66c06 --- /dev/null +++ b/api/src/Fixture/BusinessUnitRole.php @@ -0,0 +1,64 @@ +parse($this->path); + + foreach ($objects as $object) { + $businessUnit = $this->getReference($object->business_unit); + + if (!$businessUnit) { + throw new LogicException('Business Unit "'.$object->business_unit.'" does not exist.'); + } + + $businessUnitRole = new BusinessUnitRoleEntity; + $businessUnitRole + ->setBusinessUnit($businessUnit) + ->setUuid($object->uuid) + ->setOwner($object->owner) + ->setOwnerUuid($object->owner_uuid) + ->setEntityUuids((array) $object->entity_uuids) + ->setTenant($object->tenant); + + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $businessUnitRole->setCreatedAt($date); + } + + $role = $this->getReference($object->role); + + if (!$role) { + throw new LogicException('Role "'.$object->role.'" does not exist.'); + } + + $businessUnitRole->setRole($role); + $manager->persist($businessUnitRole); + } + + $manager->flush(); + } +} diff --git a/api/src/Fixture/BusinessUnitRoleFixture.php b/api/src/Fixture/BusinessUnitRoleFixture.php new file mode 100644 index 0000000..df40385 --- /dev/null +++ b/api/src/Fixture/BusinessUnitRoleFixture.php @@ -0,0 +1,33 @@ +path = '/srv/api/config/fixtures/{fixtures}/business_unit/role.yaml'; + } + + /** + * {@inheritdoc} + */ + public function getOrder() + { + return 22; + } +} diff --git a/api/src/Fixture/Individual.php b/api/src/Fixture/Individual.php index a6aade2..35fa8de 100644 --- a/api/src/Fixture/Individual.php +++ b/api/src/Fixture/Individual.php @@ -3,6 +3,7 @@ namespace App\Fixture; use App\Entity\Individual as IndividualEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; @@ -32,6 +33,13 @@ public function load(ObjectManager $manager) ->setOwner($object->owner) ->setOwnerUuid($object->owner_uuid) ->setTenant($object->tenant); + + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $individual->setCreatedAt($date); + } + $manager->persist($individual); $this->setReference($object->uuid, $individual); } diff --git a/api/src/Fixture/IndividualPersona.php b/api/src/Fixture/IndividualPersona.php index 1daf46b..41c830f 100644 --- a/api/src/Fixture/IndividualPersona.php +++ b/api/src/Fixture/IndividualPersona.php @@ -3,6 +3,7 @@ namespace App\Fixture; use App\Entity\IndividualPersona as IndividualPersonaEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; use LogicException; @@ -42,6 +43,13 @@ public function load(ObjectManager $manager) ->setTitle((array) $object->title) ->setData((array) $object->data) ->setTenant($object->tenant); + + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $persona->setCreatedAt($date); + } + $manager->persist($persona); } diff --git a/api/src/Fixture/IndividualRole.php b/api/src/Fixture/IndividualRole.php index c49bd68..a1b7ce7 100644 --- a/api/src/Fixture/IndividualRole.php +++ b/api/src/Fixture/IndividualRole.php @@ -3,6 +3,7 @@ namespace App\Fixture; use App\Entity\IndividualRole as IndividualRoleEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; use LogicException; @@ -39,8 +40,15 @@ public function load(ObjectManager $manager) ->setUuid($object->uuid) ->setOwner($object->owner) ->setOwnerUuid($object->owner_uuid) + ->setEntityUuids((array) $object->entity_uuids) ->setTenant($object->tenant); + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $individualRole->setCreatedAt($date); + } + $role = $this->getReference($object->role); if (!$role) { @@ -48,17 +56,6 @@ public function load(ObjectManager $manager) } $individualRole->setRole($role); - - foreach ($object->business_units as $uuid) { - $businessUnit = $this->getReference($uuid); - - if (!$businessUnit) { - throw new LogicException('Business Unit "'.$uuid.'" does not exist.'); - } - - $individualRole->addBusinessUnit($businessUnit); - } - $manager->persist($individualRole); } diff --git a/api/src/Fixture/Organization.php b/api/src/Fixture/Organization.php index 9fef326..d3c5119 100644 --- a/api/src/Fixture/Organization.php +++ b/api/src/Fixture/Organization.php @@ -3,6 +3,7 @@ namespace App\Fixture; use App\Entity\Organization as OrganizationEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; @@ -32,6 +33,13 @@ public function load(ObjectManager $manager) ->setOwner($object->owner) ->setOwnerUuid($object->owner_uuid) ->setTenant($object->tenant); + + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $organization->setCreatedAt($date); + } + $manager->persist($organization); $this->setReference($object->uuid, $organization); } diff --git a/api/src/Fixture/OrganizationPersona.php b/api/src/Fixture/OrganizationPersona.php index 0672674..50d671e 100644 --- a/api/src/Fixture/OrganizationPersona.php +++ b/api/src/Fixture/OrganizationPersona.php @@ -3,6 +3,7 @@ namespace App\Fixture; use App\Entity\OrganizationPersona as OrganizationPersonaEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; use LogicException; @@ -42,6 +43,13 @@ public function load(ObjectManager $manager) ->setTitle((array) $object->title) ->setData((array) $object->data) ->setTenant($object->tenant); + + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $persona->setCreatedAt($date); + } + $manager->persist($persona); $manager->flush(); } diff --git a/api/src/Fixture/OrganizationRole.php b/api/src/Fixture/OrganizationRole.php index 6ece71c..3d173db 100644 --- a/api/src/Fixture/OrganizationRole.php +++ b/api/src/Fixture/OrganizationRole.php @@ -3,6 +3,7 @@ namespace App\Fixture; use App\Entity\OrganizationRole as OrganizationRoleEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; use LogicException; @@ -39,8 +40,15 @@ public function load(ObjectManager $manager) ->setUuid($object->uuid) ->setOwner($object->owner) ->setOwnerUuid($object->owner_uuid) + ->setEntityUuids((array) $object->entity_uuids) ->setTenant($object->tenant); + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $organizationRole->setCreatedAt($date); + } + $role = $this->getReference($object->role); if (!$role) { @@ -48,17 +56,6 @@ public function load(ObjectManager $manager) } $organizationRole->setRole($role); - - foreach ($object->business_units as $uuid) { - $businessUnit = $this->getReference($uuid); - - if (!$businessUnit) { - throw new LogicException('Business Unit "'.$uuid.'" does not exist.'); - } - - $organizationRole->addBusinessUnit($businessUnit); - } - $manager->persist($organizationRole); } diff --git a/api/src/Fixture/Role.php b/api/src/Fixture/Role.php index 7040465..04358a8 100644 --- a/api/src/Fixture/Role.php +++ b/api/src/Fixture/Role.php @@ -4,6 +4,7 @@ use App\Entity\Role as RoleEntity; use App\EventListener\Entity\Role\PropagationListener; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; @@ -49,6 +50,13 @@ public function load(ObjectManager $manager) ->setData((array) $object->data) ->setPermissions((array) $object->permissions) ->setTenant($object->tenant); + + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $role->setCreatedAt($date); + } + $manager->persist($role); $this->setReference($object->uuid, $role); } diff --git a/api/src/Fixture/Staff.php b/api/src/Fixture/Staff.php index 4091d61..80bc7eb 100644 --- a/api/src/Fixture/Staff.php +++ b/api/src/Fixture/Staff.php @@ -3,6 +3,7 @@ namespace App\Fixture; use App\Entity\Staff as StaffEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; use LogicException; @@ -34,6 +35,12 @@ public function load(ObjectManager $manager) ->setOwnerUuid($object->owner_uuid) ->setTenant($object->tenant); + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $staff->setCreatedAt($date); + } + foreach ($object->business_units as $uuid) { $businessUnit = $this->getReference($uuid); diff --git a/api/src/Fixture/StaffPersona.php b/api/src/Fixture/StaffPersona.php index 5ca418d..e06e9e7 100644 --- a/api/src/Fixture/StaffPersona.php +++ b/api/src/Fixture/StaffPersona.php @@ -3,6 +3,7 @@ namespace App\Fixture; use App\Entity\StaffPersona as StaffPersonaEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; use LogicException; @@ -42,6 +43,13 @@ public function load(ObjectManager $manager) ->setTitle((array) $object->title) ->setData((array) $object->data) ->setTenant($object->tenant); + + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $persona->setCreatedAt($date); + } + $manager->persist($persona); } diff --git a/api/src/Fixture/StaffRole.php b/api/src/Fixture/StaffRole.php index 5096afb..547cb6d 100644 --- a/api/src/Fixture/StaffRole.php +++ b/api/src/Fixture/StaffRole.php @@ -3,6 +3,7 @@ namespace App\Fixture; use App\Entity\StaffRole as StaffRoleEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; use LogicException; @@ -39,8 +40,15 @@ public function load(ObjectManager $manager) ->setUuid($object->uuid) ->setOwner($object->owner) ->setOwnerUuid($object->owner_uuid) + ->setEntityUuids((array) $object->entity_uuids) ->setTenant($object->tenant); + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $staffRole->setCreatedAt($date); + } + $role = $this->getReference($object->role); if (!$role) { @@ -48,17 +56,6 @@ public function load(ObjectManager $manager) } $staffRole->setRole($role); - - foreach ($object->business_units as $uuid) { - $businessUnit = $this->getReference($uuid); - - if (!$businessUnit) { - throw new LogicException('Business Unit "'.$uuid.'" does not exist.'); - } - - $staffRole->addBusinessUnit($businessUnit); - } - $manager->persist($staffRole); } diff --git a/api/src/Fixture/System.php b/api/src/Fixture/System.php index f11d5ef..a2614ac 100644 --- a/api/src/Fixture/System.php +++ b/api/src/Fixture/System.php @@ -3,6 +3,7 @@ namespace App\Fixture; use App\Entity\System as SystemEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; @@ -32,6 +33,13 @@ public function load(ObjectManager $manager) ->setOwner($object->owner) ->setOwnerUuid($object->owner_uuid) ->setTenant($object->tenant); + + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $system->setCreatedAt($date); + } + $manager->persist($system); $this->setReference($object->uuid, $system); } diff --git a/api/src/Fixture/SystemRole.php b/api/src/Fixture/SystemRole.php index c51428b..6ae1ae8 100644 --- a/api/src/Fixture/SystemRole.php +++ b/api/src/Fixture/SystemRole.php @@ -3,6 +3,7 @@ namespace App\Fixture; use App\Entity\SystemRole as SystemRoleEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; use LogicException; @@ -39,8 +40,15 @@ public function load(ObjectManager $manager) ->setUuid($object->uuid) ->setOwner($object->owner) ->setOwnerUuid($object->owner_uuid) + ->setEntityUuids((array) $object->entity_uuids) ->setTenant($object->tenant); + if (null !== $object->created_at) { + $date = new DateTime; + $date->setTimestamp($object->created_at); + $systemRole->setCreatedAt($date); + } + $role = $this->getReference($object->role); if (!$role) { @@ -48,17 +56,6 @@ public function load(ObjectManager $manager) } $systemRole->setRole($role); - - foreach ($object->business_units as $uuid) { - $businessUnit = $this->getReference($uuid); - - if (!$businessUnit) { - throw new LogicException('Business Unit "'.$uuid.'" does not exist.'); - } - - $systemRole->addBusinessUnit($businessUnit); - } - $manager->persist($systemRole); } diff --git a/api/src/Migration/Version0_19_0.php b/api/src/Migration/Version0_19_0.php new file mode 100644 index 0000000..5664d0c --- /dev/null +++ b/api/src/Migration/Version0_19_0.php @@ -0,0 +1,255 @@ +acl = new Acl($version); + } + + /** + * Up migration + * + * @param \Doctrine\DBAL\Schema\Schema $schema + */ + public function up(Schema $schema) + { + $this->acl->up($schema); + $this->addSql('ALTER TABLE app_anonymous_role ADD entity_uuids JSON DEFAULT NULL'); + $this->addSql('COMMENT ON COLUMN app_anonymous_role.entity_uuids IS \'(DC2Type:json_array)\''); + $this->addSql('ALTER TABLE app_individual_role ADD entity_uuids JSON DEFAULT NULL'); + $this->addSql('COMMENT ON COLUMN app_individual_role.entity_uuids IS \'(DC2Type:json_array)\''); + $this->addSql('ALTER TABLE app_organization_role ADD entity_uuids JSON DEFAULT NULL'); + $this->addSql('COMMENT ON COLUMN app_organization_role.entity_uuids IS \'(DC2Type:json_array)\''); + $this->addSql('ALTER TABLE app_staff_role ADD entity_uuids JSON DEFAULT NULL'); + $this->addSql('COMMENT ON COLUMN app_staff_role.entity_uuids IS \'(DC2Type:json_array)\''); + $this->addSql('ALTER TABLE app_system_role ADD entity_uuids JSON DEFAULT NULL'); + $this->addSql('COMMENT ON COLUMN app_system_role.entity_uuids IS \'(DC2Type:json_array)\''); + $this->addSql(' + UPDATE + app_anonymous_role + SET + entity_uuids = ( + SELECT + array_to_json(array_agg(app_bu.uuid)) + FROM + app_anonymous_role_bu + INNER JOIN + app_bu ON + app_bu.id = app_anonymous_role_bu.business_unit_id + WHERE + app_anonymous_role_bu.anonymous_role_id = app_anonymous_role.id + ) + '); + $this->addSql('UPDATE app_anonymous_role SET entity_uuids = \'[]\' WHERE entity_uuids IS NULL'); + $this->addSql(' + UPDATE + app_individual_role + SET + entity_uuids = ( + SELECT + array_to_json(array_agg(app_bu.uuid)) + FROM + app_individual_role_bu + INNER JOIN + app_bu ON + app_bu.id = app_individual_role_bu.business_unit_id + WHERE + app_individual_role_bu.individual_role_id = app_individual_role.id + ) + '); + $this->addSql('UPDATE app_individual_role SET entity_uuids = \'[]\' WHERE entity_uuids IS NULL'); + $this->addSql(' + UPDATE + app_organization_role + SET + entity_uuids = ( + SELECT + array_to_json(array_agg(app_bu.uuid)) + FROM + app_organization_role_bu + INNER JOIN + app_bu ON + app_bu.id = app_organization_role_bu.business_unit_id + WHERE + app_organization_role_bu.organization_role_id = app_organization_role.id + ) + '); + $this->addSql('UPDATE app_organization_role SET entity_uuids = \'[]\' WHERE entity_uuids IS NULL'); + $this->addSql(' + UPDATE + app_staff_role + SET + entity_uuids = ( + SELECT + array_to_json(array_agg(app_bu.uuid)) + FROM + app_staff_role_bu + INNER JOIN + app_bu ON + app_bu.id = app_staff_role_bu.business_unit_id + WHERE + app_staff_role_bu.staff_role_id = app_staff_role.id + ) + '); + $this->addSql('UPDATE app_staff_role SET entity_uuids = \'[]\' WHERE entity_uuids IS NULL'); + $this->addSql(' + UPDATE + app_system_role + SET + entity_uuids = ( + SELECT + array_to_json(array_agg(app_bu.uuid)) + FROM + app_system_role_bu + INNER JOIN + app_bu ON + app_bu.id = app_system_role_bu.business_unit_id + WHERE + app_system_role_bu.system_role_id = app_system_role.id + ) + '); + $this->addSql('UPDATE app_system_role SET entity_uuids = \'[]\' WHERE entity_uuids IS NULL'); + $this->addSql('ALTER TABLE app_anonymous_role ALTER entity_uuids SET NOT NULL'); + $this->addSql('ALTER TABLE app_individual_role ALTER entity_uuids SET NOT NULL'); + $this->addSql('ALTER TABLE app_organization_role ALTER entity_uuids SET NOT NULL'); + $this->addSql('ALTER TABLE app_staff_role ALTER entity_uuids SET NOT NULL'); + $this->addSql('ALTER TABLE app_system_role ALTER entity_uuids SET NOT NULL'); + $this->addSql('DROP TABLE app_anonymous_role_bu'); + $this->addSql('DROP TABLE app_individual_role_bu'); + $this->addSql('DROP TABLE app_organization_role_bu'); + $this->addSql('DROP TABLE app_staff_role_bu'); + $this->addSql('DROP TABLE app_system_role_bu'); + $this->addSql('CREATE SEQUENCE app_bu_role_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE TABLE app_bu_role (id INT NOT NULL, business_unit_id INT DEFAULT NULL, role_id INT DEFAULT NULL, uuid UUID NOT NULL, "owner" VARCHAR(255) DEFAULT NULL, owner_uuid UUID DEFAULT NULL, entity_uuids JSON NOT NULL, version INT DEFAULT 1 NOT NULL, tenant UUID NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_FB9993E1D17F50A6 ON app_bu_role (uuid)'); + $this->addSql('CREATE INDEX IDX_FB9993E1A58ECB40 ON app_bu_role (business_unit_id)'); + $this->addSql('CREATE INDEX IDX_FB9993E1D60322AC ON app_bu_role (role_id)'); + $this->addSql('COMMENT ON COLUMN app_bu_role.entity_uuids IS \'(DC2Type:json_array)\''); + $this->addSql('ALTER TABLE app_bu_role ADD CONSTRAINT FK_A2DAA637A58ECB40 FOREIGN KEY (business_unit_id) REFERENCES app_bu (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE app_bu_role ADD CONSTRAINT FK_A2DAA637D60322AC FOREIGN KEY (role_id) REFERENCES app_role (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + } + + /** + * Down migration + * + * @param \Doctrine\DBAL\Schema\Schema $schema + */ + public function down(Schema $schema) + { + $this->acl->down($schema); + $this->addSql('CREATE TABLE app_anonymous_role_bu (anonymous_role_id INT NOT NULL, business_unit_id INT NOT NULL, PRIMARY KEY(anonymous_role_id, business_unit_id))'); + $this->addSql('CREATE INDEX IDX_B09CAAD23089E0B ON app_anonymous_role_bu (anonymous_role_id)'); + $this->addSql('CREATE INDEX IDX_B09CAADA58ECB40 ON app_anonymous_role_bu (business_unit_id)'); + $this->addSql('CREATE TABLE app_individual_role_bu (individual_role_id INT NOT NULL, business_unit_id INT NOT NULL, PRIMARY KEY(individual_role_id, business_unit_id))'); + $this->addSql('CREATE INDEX IDX_68A9160EFDFA321 ON app_individual_role_bu (individual_role_id)'); + $this->addSql('CREATE INDEX IDX_68A9160A58ECB40 ON app_individual_role_bu (business_unit_id)'); + $this->addSql('CREATE TABLE app_organization_role_bu (organization_role_id INT NOT NULL, business_unit_id INT NOT NULL, PRIMARY KEY(organization_role_id, business_unit_id))'); + $this->addSql('CREATE INDEX IDX_79C5DB011BD1AAEF ON app_organization_role_bu (organization_role_id)'); + $this->addSql('CREATE INDEX IDX_79C5DB01A58ECB40 ON app_organization_role_bu (business_unit_id)'); + $this->addSql('CREATE TABLE app_staff_role_bu (staff_role_id INT NOT NULL, business_unit_id INT NOT NULL, PRIMARY KEY(staff_role_id, business_unit_id))'); + $this->addSql('CREATE INDEX IDX_998CF18F8AB5351A ON app_staff_role_bu (staff_role_id)'); + $this->addSql('CREATE INDEX IDX_998CF18FA58ECB40 ON app_staff_role_bu (business_unit_id)'); + $this->addSql('CREATE TABLE app_system_role_bu (system_role_id INT NOT NULL, business_unit_id INT NOT NULL, PRIMARY KEY(system_role_id, business_unit_id))'); + $this->addSql('CREATE INDEX IDX_6CCE35F83A705E3F ON app_system_role_bu (system_role_id)'); + $this->addSql('CREATE INDEX IDX_6CCE35F8A58ECB40 ON app_system_role_bu (business_unit_id)'); + $this->addSql(' + INSERT INTO app_anonymous_role_bu ( + anonymous_role_id, + business_unit_id + ) + SELECT + app_anonymous_role.id, + app_bu.id + FROM + app_anonymous_role, + app_bu + WHERE + app_anonymous_role.entity_uuids::text LIKE CONCAT(\'%\', app_bu.uuid, \'%\') + '); + $this->addSql(' + INSERT INTO app_individual_role_bu ( + individual_role_id, + business_unit_id + ) + SELECT + app_individual_role.id, + app_bu.id + FROM + app_individual_role, + app_bu + WHERE + app_individual_role.entity_uuids::text LIKE CONCAT(\'%\', app_bu.uuid, \'%\') + '); + $this->addSql(' + INSERT INTO app_organization_role_bu ( + organization_role_id, + business_unit_id + ) + SELECT + app_organization_role.id, + app_bu.id + FROM + app_organization_role, + app_bu + WHERE + app_organization_role.entity_uuids::text LIKE CONCAT(\'%\', app_bu.uuid, \'%\') + '); + $this->addSql(' + INSERT INTO app_staff_role_bu ( + staff_role_id, + business_unit_id + ) + SELECT + app_staff_role.id, + app_bu.id + FROM + app_staff_role, + app_bu + WHERE + app_staff_role.entity_uuids::text LIKE CONCAT(\'%\', app_bu.uuid, \'%\') + '); + $this->addSql(' + INSERT INTO app_system_role_bu ( + system_role_id, + business_unit_id + ) + SELECT + app_system_role.id, + app_bu.id + FROM + app_system_role, + app_bu + WHERE + app_system_role.entity_uuids::text LIKE CONCAT(\'%\', app_bu.uuid, \'%\') + '); + $this->addSql('ALTER TABLE app_anonymous_role DROP entity_uuids'); + $this->addSql('ALTER TABLE app_individual_role DROP entity_uuids'); + $this->addSql('ALTER TABLE app_organization_role DROP entity_uuids'); + $this->addSql('ALTER TABLE app_staff_role DROP entity_uuids'); + $this->addSql('ALTER TABLE app_system_role DROP entity_uuids'); + $this->addSql('DROP TABLE app_bu_role'); + $this->addSql('DROP SEQUENCE app_bu_role_id_seq CASCADE'); + } +} diff --git a/api/src/Repository/AnonymousRoleRepository.php b/api/src/Repository/AnonymousRoleRepository.php index e998eea..906e973 100644 --- a/api/src/Repository/AnonymousRoleRepository.php +++ b/api/src/Repository/AnonymousRoleRepository.php @@ -5,6 +5,6 @@ /** * Class AnonymousRoleRepository */ -final class AnonymousRoleRepository extends BusinessUnitRoleRepository +final class AnonymousRoleRepository extends AssignedRoleRepository { } diff --git a/api/src/Repository/AssignedRoleRepository.php b/api/src/Repository/AssignedRoleRepository.php new file mode 100644 index 0000000..5b6caca --- /dev/null +++ b/api/src/Repository/AssignedRoleRepository.php @@ -0,0 +1,12 @@ +setType($servicePermission['scope']['type']) - ->setEntity($servicePermission['scope']['entity']) - ->setEntityUuid($servicePermission['scope']['entityUuid']); $permission - ->setScope($scope) + ->setScope($servicePermission['scope']) ->setKey($entry['key']) ->setAttributes($entry['attributes']); $access->addPermission($permission); diff --git a/api/src/Tenant/Loader/Identity/StaffRole.php b/api/src/Tenant/Loader/Identity/StaffRole.php index ed75189..ae9efb4 100644 --- a/api/src/Tenant/Loader/Identity/StaffRole.php +++ b/api/src/Tenant/Loader/Identity/StaffRole.php @@ -39,6 +39,7 @@ public function load(Tenant $tenant) ->setStaff($staff) ->setOwner($object->owner) ->setOwnerUuid($object->owner_uuid) + ->setEntityUuids((array) $object->entity_uuids) ->setRole($role) ->setTenant($object->tenant); $manager->persist($staffRole); diff --git a/api/src/Validator/Constraints/Role/Permissions/Valid.php b/api/src/Validator/Constraints/Role/Permissions/Valid.php index db5152d..2d917b6 100644 --- a/api/src/Validator/Constraints/Role/Permissions/Valid.php +++ b/api/src/Validator/Constraints/Role/Permissions/Valid.php @@ -11,57 +11,6 @@ */ final class Valid extends Constraint { - /** - * @var string - */ - public $serviceUndefined = 'Permissions object contains undefined service {{ service }}.'; - - /** - * @var string - */ - public $permissionsNotArray = '{{ service }} permissions should be an array.'; - - /** - * @var string - */ - public $permissionNotObject = '{{ service }} permission should be an object.'; - - /** - * @var string - */ - public $permissionAttributeMissing = '{{ service }} permission object is missing attribute {{ attribute }}.'; - - /** - * @var string - */ - public $subscopeNotArray = '{{ service }} subscope should be an array.'; - - /** - * @var string - */ - public $subscopeAttributeMissing = '{{ service }} subscope object is missing attribute {{ attribute }}.'; - - /** - * @var string - */ - public $subpermissionsNotArray = '{{ service }} subpermissions should be an array.'; - - /** - * @var string - */ - public $subpermissionNotObject = '{{ service }} subpermission should be an object.'; - - /** - * @var string - */ - public $subpermissionAttributeMissing = '{{ service }} subpermission object is missing attribute {{ attribute }}.'; - - /** - * @var string - */ - public $subpermissionUndefined = '{{ service }} subpermission object contains undefined attribute {{ attribute }}.'; - - /** * {@inheritdoc} */ diff --git a/api/src/Validator/Constraints/Role/Permissions/ValidValidator.php b/api/src/Validator/Constraints/Role/Permissions/ValidValidator.php index a41682e..ab21919 100644 --- a/api/src/Validator/Constraints/Role/Permissions/ValidValidator.php +++ b/api/src/Validator/Constraints/Role/Permissions/ValidValidator.php @@ -4,6 +4,7 @@ use Ds\Component\Api\Collection\ServiceCollection; use Ds\Component\Acl\Model\Permission; +use JsonSchema\Validator; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; @@ -57,114 +58,61 @@ public function __construct(ServiceCollection $serviceCollection) */ public function validate($role, Constraint $constraint) { - foreach ($role->getPermissions() as $service => $permissions) { - if (!$this->serviceCollection->containsKey($service.'.access')) { - $this->context - ->buildViolation($constraint->serviceUndefined) - ->setParameter('{{ service }}', '"' . $service . '"') - ->atPath('permissions.' . $service) - ->addViolation(); - - continue; - } - - if (!is_array($permissions)) { - $this->context - ->buildViolation($constraint->permissionsNotArray) - ->setParameter('{{ service }}', '"'.$service.'"') - ->atPath('permissions.'.$service) - ->addViolation(); - - continue; - } - - foreach ($permissions as $index => $permission) { - if (!is_array($permission)) { - $this->context - ->buildViolation($constraint->permissionNotObject) - ->setParameter('{{ service }}', '"'.$service.'"') - ->atPath('permissions.'.$service.'['.$index.']') - ->addViolation(); - - continue; - } - - foreach (['scope', 'permissions'] as $attribute) { - if (!array_key_exists($attribute, $permission)) { - $this->context - ->buildViolation($constraint->permissionAttributeMissing) - ->setParameter('{{ service }}', '"'.$service.'"') - ->setParameter('{{ attribute }}', '"'.$attribute.'"') - ->atPath('permissions.'.$service.'['.$index.'].'.$attribute) - ->addViolation(); - } - - if ('scope' === $attribute) { - if (!is_array($permission['scope'])) { - $this->context - ->buildViolation($constraint->subscopeNotArray) - ->setParameter('{{ service }}', '"'.$service.'"') - ->atPath('scope.'.$service.'['.$index.'].permissions') - ->addViolation(); - - continue; - } - - foreach (['type', 'entity', 'entityUuid'] as $subattribute) { - if (!array_key_exists($subattribute, $permission['scope'])) { - $this->context - ->buildViolation($constraint->subscopeAttributeMissing) - ->setParameter('{{ service }}', '"'.$service.'"') - ->setParameter('{{ attribute }}', '"'.$subattribute.'"') - ->atPath('permissions.'.$service.'['.$index.'].'.$attribute.'.'.$subattribute) - ->addViolation(); - - continue; + $validator = new Validator; + $property = ' + { + "type": "array", + "items": { + "type": "array", + "additionalProperties": false, + "required": ["scope", "permissions"], + "properties": { + "scope": { + "type": "array", + "additionalProperties": false, + "properties": { + "operator": { + "type": "string", + "enum": ["and", "or"] + }, + "conditions": { + "type": "array" + }, + "type": { + "type": "string", + "enum": ["generic", "object", "identity", "owner", "session", "property"] + }, + "entity": { + "type": ["string", "null"] + }, + "entity_uuid": { + "type": ["string", "null"] + }, + "property": { + "type": "string" + }, + "comparison": { + "type": "string", + "enum": ["eq", "neq", "like"] + }, + "value": {} } - } - } else if ('permissions' === $attribute) { - if (!is_array($permission['permissions'])) { - $this->context - ->buildViolation($constraint->subpermissionsNotArray) - ->setParameter('{{ service }}', '"'.$service.'"') - ->atPath('permissions.'.$service.'['.$index.'].permissions') - ->addViolation(); - - continue; - } - - foreach ($permission['permissions'] as $subindex => $subpermission) { - if (!is_array($subpermission)) { - $this->context - ->buildViolation($constraint->subpermissionNotObject) - ->setParameter('{{ service }}', '"'.$service.'"') - ->atPath('permissions.'.$service.'['.$index.'].permissions['.$subindex.']') - ->addViolation(); - - continue; - } - - foreach (['key', 'attributes'] as $subattribute) { - if (!array_key_exists($subattribute, $subpermission)) { - $this->context - ->buildViolation($constraint->subpermissionAttributeMissing) - ->setParameter('{{ service }}', '"'.$service.'"') - ->setParameter('{{ attribute }}', '"'.$subattribute.'"') - ->atPath('permissions.'.$service.'['.$index.'].'.$attribute.'['.$subindex.'].'.$subattribute) - ->addViolation(); - - continue; - } - - if ('attributes' === $subattribute) { - foreach ($subpermission['attributes'] as $item) { - if (!in_array($item, [Permission::BROWSE, Permission::READ, Permission::EDIT, Permission::ADD, Permission::DELETE, Permission::EXECUTE])) { - $this->context - ->buildViolation($constraint->subpermissionUndefined) - ->setParameter('{{ service }}', '"'.$service.'"') - ->setParameter('{{ attribute }}', '"'.$item.'"') - ->atPath('permissions.'.$service.'['.$index.'].'.$attribute.'['.$subindex.'].attributes') - ->addViolation(); + }, + "permissions": { + "type": "array", + "items": { + "type": "array", + "additionalProperties": false, + "required": ["key", "attributes"], + "properties": { + "key": { + "type": "string" + }, + "attributes": { + "type": "array", + "items": { + "type": "string", + "enum": ["BROWSE", "READ", "EDIT", "ADD", "DELETE", "EXECUTE"] } } } @@ -173,6 +121,36 @@ public function validate($role, Constraint $constraint) } } } + '; + $schema = json_decode(' + { + "type": "array", + "additionalProperties": false, + "properties": { + "assets": ' . $property . ', + "authentication": ' . $property . ', + "cases": ' . $property . ', + "cms": ' . $property . ', + "forms": ' . $property . ', + "identities": ' . $property . ', + "microservice": ' . $property . ', + "records": ' . $property . ', + "services": ' . $property . ', + "tasks": ' . $property . ', + "tenants": ' . $property . ' + } + } + '); + $permissions = $role->getPermissions(); + $validator->validate($permissions, $schema); + + if (!$validator->isValid()) { + foreach ($validator->getErrors() as $error) { + $this->context + ->buildViolation($error['message']) + ->atPath('permissions.' . $error['property']) + ->addViolation(); + } } } } 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 6d748df..9c2c5f0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,7 @@ services: - identities_database php: - image: digitalstate/identities:php-0.18.2 + image: digitalstate/identities:php-0.19.0 depends_on: - database env_file: @@ -44,7 +44,7 @@ services: - identities_php api: - image: digitalstate/identities:api-0.18.2 + image: digitalstate/identities:api-0.19.0 depends_on: - php networks: