From 0ffe8cb6efdcdf60f4b77b882f3dd1ae289a3dba Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Thu, 30 Jul 2020 14:59:12 -0400 Subject: [PATCH 01/27] Refactor based on new core --- api/composer.json | 1 + api/composer.lock | 71 ++++++++++++++++++- .../fixtures/dev/access/role/permission.yaml | 2 - api/config/packages/doctrine.yaml | 12 ++++ api/config/tenant/loader/acl.yaml | 2 - api/src/Migration/Version0_19_0.php | 50 +++++++++++++ api/symfony.lock | 3 + 7 files changed, 134 insertions(+), 7 deletions(-) create mode 100644 api/src/Migration/Version0_19_0.php diff --git a/api/composer.json b/api/composer.json index 0d2a620..11f5116 100644 --- a/api/composer.json +++ b/api/composer.json @@ -18,6 +18,7 @@ "knplabs/doctrine-behaviors": "^1.5", "lexik/jwt-authentication-bundle": "^2.6", "ramsey/uuid": "^3.8", + "scienta/doctrine-json-functions": "^4.1", "sensio/framework-extra-bundle": "^5.2", "sensiolabs/security-checker": "^5.0", "symfony/console": "^4.0", diff --git a/api/composer.lock b/api/composer.lock index aac266e..b861775 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": "a8c3c03ed890d64b69c7a84d2ec08344", "packages": [ { "name": "api-platform/api-pack", @@ -2997,6 +2997,68 @@ ], "time": "2018-07-19T23:38:55+00:00" }, + { + "name": "scienta/doctrine-json-functions", + "version": "4.1.2", + "source": { + "type": "git", + "url": "https://github.com/ScientaNL/DoctrineJsonFunctions.git", + "reference": "6cab3f93a7415dbc889da15336c7605efbfe7bd4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ScientaNL/DoctrineJsonFunctions/zipball/6cab3f93a7415dbc889da15336c7605efbfe7bd4", + "reference": "6cab3f93a7415dbc889da15336c7605efbfe7bd4", + "shasum": "" + }, + "require": { + "ext-pdo": "*", + "php": "^7.1" + }, + "require-dev": { + "doctrine/coding-standard": "^5.0", + "doctrine/orm": "~2.6", + "phpunit/phpunit": "^6.5" + }, + "suggest": { + "dunglas/doctrine-json-odm": "To serialize / deserialize objects as JSON documents." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Scienta\\DoctrineJsonFunctions\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Doctrine Json Functions Contributors", + "homepage": "https://github.com/ScientaNL/DoctrineJsonFunctions/contributors" + } + ], + "description": "A set of extensions to Doctrine 2 that add support for json query functions.", + "keywords": [ + "database", + "doctrine", + "dql", + "json", + "mariadb", + "mysql", + "orm", + "postgres", + "postgresql", + "sqlite" + ], + "time": "2020-02-07T11:05:21+00:00" + }, { "name": "sensio/framework-extra-bundle", "version": "v5.2.4", @@ -6247,6 +6309,7 @@ "code", "zf2" ], + "abandoned": "laminas/laminas-code", "time": "2018-08-13T20:36:59+00:00" }, { @@ -6301,6 +6364,7 @@ "events", "zf2" ], + "abandoned": "laminas/laminas-eventmanager", "time": "2018-04-25T15:33:34+00:00" } ], @@ -7883,5 +7947,6 @@ "php": "^7.1.3", "ext-iconv": "*" }, - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "1.1.0" } diff --git a/api/config/fixtures/dev/access/role/permission.yaml b/api/config/fixtures/dev/access/role/permission.yaml index 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/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/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/src/Migration/Version0_19_0.php b/api/src/Migration/Version0_19_0.php new file mode 100644 index 0000000..0f3121f --- /dev/null +++ b/api/src/Migration/Version0_19_0.php @@ -0,0 +1,50 @@ +acl = new Acl($version); + } + + /** + * Up migration + * + * @param \Doctrine\DBAL\Schema\Schema $schema + */ + public function up(Schema $schema) + { + $this->acl->up($schema); + } + + /** + * Down migration + * + * @param \Doctrine\DBAL\Schema\Schema $schema + */ + public function down(Schema $schema) + { + $this->acl->down($schema); + } +} diff --git a/api/symfony.lock b/api/symfony.lock index e08f1ac..67f9a30 100644 --- a/api/symfony.lock +++ b/api/symfony.lock @@ -245,6 +245,9 @@ "ramsey/uuid": { "version": "3.8.0" }, + "scienta/doctrine-json-functions": { + "version": "4.1.2" + }, "sensio/framework-extra-bundle": { "version": "5.2", "recipe": { From 87d38c4ba3bd99c04e7f11b11e61ff4365337f34 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Thu, 30 Jul 2020 15:34:26 -0400 Subject: [PATCH 02/27] Update api version --- api/config/packages/api_platform.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/config/packages/api_platform.yaml b/api/config/packages/api_platform.yaml index 0804f5b..87576a4 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 From 44b2f12f0b46454b7d6b402ad527aeef0375474b Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Thu, 30 Jul 2020 15:48:44 -0400 Subject: [PATCH 03/27] Update docker image version --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 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: From 9ac22b923d54ae3d0911b02b3e2887eaf308fb45 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 2 Aug 2020 07:12:29 -0400 Subject: [PATCH 04/27] Update digitalstate/core dependency --- api/composer.json | 2 +- api/composer.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/composer.json b/api/composer.json index 11f5116..cc83193 100644 --- a/api/composer.json +++ b/api/composer.json @@ -11,7 +11,7 @@ "ext-iconv": "*", "api-platform/api-pack": "^1.1", "defuse/php-encryption": "^2.2", - "digitalstate/core": "0.18.0", + "digitalstate/core": "0.19.0", "doctrine/doctrine-fixtures-bundle": "^3.0", "doctrine/doctrine-migrations-bundle": "^1.3", "guzzlehttp/guzzle": "^6.3", diff --git a/api/composer.lock b/api/composer.lock index b861775..48defec 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -330,16 +330,16 @@ }, { "name": "digitalstate/core", - "version": "0.18.0", + "version": "0.19.0", "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "c94e4b990ef1a7f1adc76b89d06d95f6a47721ec" + "reference": "7caa21bd878923e318dc5e4b214846fb11eae96c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/c94e4b990ef1a7f1adc76b89d06d95f6a47721ec", - "reference": "c94e4b990ef1a7f1adc76b89d06d95f6a47721ec", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/7caa21bd878923e318dc5e4b214846fb11eae96c", + "reference": "7caa21bd878923e318dc5e4b214846fb11eae96c", "shasum": "" }, "require": { From 91d830b6e08cb5536dbfd0f94689f108e223fc57 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 2 Aug 2020 07:57:18 -0400 Subject: [PATCH 05/27] Update digitalstate/core dependency --- api/composer.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/composer.lock b/api/composer.lock index 48defec..155b73f 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "7caa21bd878923e318dc5e4b214846fb11eae96c" + "reference": "4c2371640e087c2490231085d8df7f9109e9bda3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/7caa21bd878923e318dc5e4b214846fb11eae96c", - "reference": "7caa21bd878923e318dc5e4b214846fb11eae96c", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/4c2371640e087c2490231085d8df7f9109e9bda3", + "reference": "4c2371640e087c2490231085d8df7f9109e9bda3", "shasum": "" }, "require": { From eebed1dc82c1be689c7c3b3fc8817ea5c711b80f Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Mon, 3 Aug 2020 10:31:24 -0400 Subject: [PATCH 06/27] Refactor based on new core --- .../fixtures/dev/identity/anonymous/role.yaml | 2 +- .../dev/identity/individual/role.yaml | 2 +- .../dev/identity/organization/role.yaml | 2 +- .../fixtures/dev/identity/staff/role.yaml | 2 +- .../fixtures/dev/identity/system/role.yaml | 2 +- .../test/identity/anonymous/role.yaml | 2 +- .../test/identity/individual/role.yaml | 2 +- .../test/identity/organization/role.yaml | 2 +- .../fixtures/test/identity/staff/role.yaml | 2 +- api/config/packages/ds_acl.yaml | 12 +- .../tenant/loader/identity/staff/role.yaml | 2 +- api/src/Entity/AnonymousRole.php | 33 +-- ...{BusinessUnitRole.php => AssignedRole.php} | 38 +++- api/src/Entity/Attribute/Accessor/Roles.php | 10 +- api/src/Entity/BusinessUnit.php | 9 - api/src/Entity/IndividualRole.php | 33 +-- api/src/Entity/OrganizationRole.php | 33 +-- api/src/Entity/StaffRole.php | 33 +-- api/src/Entity/SystemRole.php | 33 +-- api/src/Fixture/AnonymousRole.php | 12 +- api/src/Fixture/IndividualRole.php | 12 +- api/src/Fixture/OrganizationRole.php | 12 +- api/src/Fixture/StaffRole.php | 12 +- api/src/Fixture/SystemRole.php | 12 +- api/src/Migration/Version0_19_0.php | 195 ++++++++++++++++++ .../Repository/AnonymousRoleRepository.php | 2 +- api/src/Repository/AssignedRoleRepository.php | 12 ++ .../Repository/BusinessUnitRoleRepository.php | 12 -- .../Repository/IndividualRoleRepository.php | 2 +- .../Repository/OrganizationRoleRepository.php | 2 +- api/src/Repository/StaffRoleRepository.php | 2 +- api/src/Repository/SystemRoleRepository.php | 2 +- api/src/Tenant/Loader/Identity/StaffRole.php | 1 + 33 files changed, 286 insertions(+), 258 deletions(-) rename api/src/Entity/{BusinessUnitRole.php => AssignedRole.php} (71%) create mode 100644 api/src/Repository/AssignedRoleRepository.php delete mode 100644 api/src/Repository/BusinessUnitRoleRepository.php diff --git a/api/config/fixtures/dev/identity/anonymous/role.yaml b/api/config/fixtures/dev/identity/anonymous/role.yaml index d92d410..4639cc4 100644 --- a/api/config/fixtures/dev/identity/anonymous/role.yaml +++ b/api/config/fixtures/dev/identity/anonymous/role.yaml @@ -6,5 +6,5 @@ prototype: 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/role.yaml b/api/config/fixtures/dev/identity/individual/role.yaml index a02adf5..c53f27f 100644 --- a/api/config/fixtures/dev/identity/individual/role.yaml +++ b/api/config/fixtures/dev/identity/individual/role.yaml @@ -11,5 +11,5 @@ prototype: 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/role.yaml b/api/config/fixtures/dev/identity/organization/role.yaml index 180740a..0cda068 100644 --- a/api/config/fixtures/dev/identity/organization/role.yaml +++ b/api/config/fixtures/dev/identity/organization/role.yaml @@ -9,5 +9,5 @@ prototype: 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/role.yaml b/api/config/fixtures/dev/identity/staff/role.yaml index b1f4081..e6d14ff 100644 --- a/api/config/fixtures/dev/identity/staff/role.yaml +++ b/api/config/fixtures/dev/identity/staff/role.yaml @@ -22,5 +22,5 @@ prototype: 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/role.yaml b/api/config/fixtures/dev/identity/system/role.yaml index ba80ea6..97d261f 100644 --- a/api/config/fixtures/dev/identity/system/role.yaml +++ b/api/config/fixtures/dev/identity/system/role.yaml @@ -6,5 +6,5 @@ prototype: owner: System owner_uuid: ~ role: ~ - business_units: [] + entity_uuids: [] tenant: e5a2120d-6bf7-4c58-a900-bac1e55e986b # Tenant 1 diff --git a/api/config/fixtures/test/identity/anonymous/role.yaml b/api/config/fixtures/test/identity/anonymous/role.yaml index fc41128..b28cbe3 100644 --- a/api/config/fixtures/test/identity/anonymous/role.yaml +++ b/api/config/fixtures/test/identity/anonymous/role.yaml @@ -6,5 +6,5 @@ prototype: owner: BusinessUnit owner_uuid: ~ role: ~ - business_units: [] + entity_uuids: [] tenant: ~ diff --git a/api/config/fixtures/test/identity/individual/role.yaml b/api/config/fixtures/test/identity/individual/role.yaml index 171e245..1449776 100644 --- a/api/config/fixtures/test/identity/individual/role.yaml +++ b/api/config/fixtures/test/identity/individual/role.yaml @@ -6,5 +6,5 @@ prototype: owner: BusinessUnit owner_uuid: ~ role: ~ - business_units: [] + entity_uuids: [] tenant: ~ diff --git a/api/config/fixtures/test/identity/organization/role.yaml b/api/config/fixtures/test/identity/organization/role.yaml index e0b2c45..aa257de 100644 --- a/api/config/fixtures/test/identity/organization/role.yaml +++ b/api/config/fixtures/test/identity/organization/role.yaml @@ -6,5 +6,5 @@ prototype: owner: BusinessUnit owner_uuid: ~ role: ~ - business_units: [] + entity_uuids: [] tenant: ~ diff --git a/api/config/fixtures/test/identity/staff/role.yaml b/api/config/fixtures/test/identity/staff/role.yaml index 4c3657b..654244a 100644 --- a/api/config/fixtures/test/identity/staff/role.yaml +++ b/api/config/fixtures/test/identity/staff/role.yaml @@ -6,5 +6,5 @@ prototype: owner: BusinessUnit owner_uuid: ~ role: ~ - business_units: [] + entity_uuids: [] tenant: ~ diff --git a/api/config/packages/ds_acl.yaml b/api/config/packages/ds_acl.yaml index 01cc792..390a146 100644 --- a/api/config/packages/ds_acl.yaml +++ b/api/config/packages/ds_acl.yaml @@ -53,7 +53,7 @@ ds_acl: anonymous_role_owner_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.owner_uuid, 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.entity_uuids, 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 } @@ -106,7 +106,7 @@ ds_acl: individual_role_owner_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.owner_uuid, 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.entity_uuids, 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 } @@ -145,7 +145,7 @@ ds_acl: organization_role_owner_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.owner_uuid, 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.entity_uuids, 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 } @@ -200,7 +200,7 @@ ds_acl: staff_role_owner_uuid: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.owner_uuid, 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.entity_uuids, 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 } @@ -223,8 +223,8 @@ ds_acl: system_role_updated_at: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.updated_at, 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_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.entity_uuids, 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/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/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/BusinessUnitRole.php b/api/src/Entity/AssignedRole.php similarity index 71% rename from api/src/Entity/BusinessUnitRole.php rename to api/src/Entity/AssignedRole.php index 6852140..2112765 100644 --- a/api/src/Entity/BusinessUnitRole.php +++ b/api/src/Entity/AssignedRole.php @@ -20,9 +20,9 @@ use Symfony\Component\Validator\Constraints as Assert; /** - * Class BusinessUnitRole + * Class AssignedRole */ -abstract class BusinessUnitRole implements Identifiable, Uuidentifiable, Ownable, Versionable, Tenantable +abstract class AssignedRole implements Identifiable, Uuidentifiable, Ownable, Versionable, Tenantable { use Behavior\Timestampable\Timestampable; @@ -31,13 +31,14 @@ abstract class BusinessUnitRole implements Identifiable, Uuidentifiable, Ownable use Accessor\Owner; use Accessor\OwnerUuid; use EntityAccessor\Role; + use Accessor\EntityUuids; use Accessor\Version; use TenantAccessor\Tenant; /** * @var integer * @ApiProperty(identifier=false, writable=false) - * @Serializer\Groups({"business_unit_role_output"}) + * @Serializer\Groups({"assigned_role_output"}) * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") * @ORM\Column(name="id", type="integer") @@ -47,7 +48,7 @@ abstract class BusinessUnitRole implements Identifiable, Uuidentifiable, Ownable /** * @var string * @ApiProperty(identifier=true, writable=false) - * @Serializer\Groups({"business_unit_role_output"}) + * @Serializer\Groups({"assigned_role_output"}) * @ORM\Column(name="uuid", type="guid", unique=true) * @Assert\Uuid */ @@ -56,21 +57,21 @@ abstract class BusinessUnitRole implements Identifiable, Uuidentifiable, Ownable /** * @var \DateTime * @ApiProperty(writable=false) - * @Serializer\Groups({"business_unit_role_output"}) + * @Serializer\Groups({"assigned_role_output"}) */ protected $createdAt; /** * @var \DateTime * @ApiProperty(writable=false) - * @Serializer\Groups({"business_unit_role_output"}) + * @Serializer\Groups({"assigned_role_output"}) */ protected $updatedAt; /** * @var string * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) + * @Serializer\Groups({"assigned_role_output", "assigned_role_input"}) * @ORM\Column(name="`owner`", type="string", length=255, nullable=true) * @Assert\NotBlank */ @@ -79,7 +80,7 @@ abstract class BusinessUnitRole implements Identifiable, Uuidentifiable, Ownable /** * @var string * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) + * @Serializer\Groups({"assigned_role_output", "assigned_role_input"}) * @ORM\Column(name="owner_uuid", type="guid", nullable=true) * @Assert\NotBlank * @Assert\Uuid @@ -89,7 +90,7 @@ abstract class BusinessUnitRole implements Identifiable, Uuidentifiable, Ownable /** * @var \App\Entity\Role * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) + * @Serializer\Groups({"assigned_role_output", "assigned_role_input"}) * @ORM\ManyToOne(targetEntity="App\Entity\Role") * @ORM\JoinColumn(name="role_id", referencedColumnName="id") * @ORM\Cache(usage="NONSTRICT_READ_WRITE") @@ -97,10 +98,17 @@ abstract class BusinessUnitRole implements Identifiable, Uuidentifiable, Ownable */ protected $role; + /** + * @var string + * @Serializer\Groups({"assigned_role_output", "assigned_role_input"}) + * @ORM\Column(name="entity_uuids", type="json_array") + */ + protected $entityUuids; + /** * @var integer * @ApiProperty - * @Serializer\Groups({"business_unit_role_output", "business_unit_role_input"}) + * @Serializer\Groups({"assigned_role_output", "assigned_role_input"}) * @ORM\Column(name="version", type="integer") * @ORM\Version * @Assert\NotBlank @@ -111,9 +119,17 @@ abstract class BusinessUnitRole implements Identifiable, Uuidentifiable, Ownable /** * @var string * @ApiProperty(writable=false) - * @Serializer\Groups({"business_unit_role_output"}) + * @Serializer\Groups({"assigned_role_output"}) * @ORM\Column(name="tenant", type="guid") * @Assert\Uuid */ protected $tenant; + + /** + * Constructor + */ + public function __construct() + { + $this->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..d05d2dd 100644 --- a/api/src/Entity/BusinessUnit.php +++ b/api/src/Entity/BusinessUnit.php @@ -160,14 +160,6 @@ class BusinessUnit implements Identifiable, Uuidentifiable, Ownable, Translatabl */ private $staffs; - /** - * @var \Doctrine\Common\Collections\Collection - * @ApiProperty(writable=false) - * @ORM\ManyToMany(targetEntity="Individual", mappedBy="businessUnits") - * @ORM\Cache(usage="NONSTRICT_READ_WRITE") - */ - private $individuals; - /** * @var integer * @ApiProperty @@ -196,6 +188,5 @@ public function __construct() $this->title = []; $this->data = []; $this->staffs = new ArrayCollection; - $this->individuals = new ArrayCollection; } } 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/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/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/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/AnonymousRole.php b/api/src/Fixture/AnonymousRole.php index 69c86af..5d19149 100644 --- a/api/src/Fixture/AnonymousRole.php +++ b/api/src/Fixture/AnonymousRole.php @@ -39,6 +39,7 @@ public function load(ObjectManager $manager) ->setUuid($object->uuid) ->setOwner($object->owner) ->setOwnerUuid($object->owner_uuid) + ->setEntityUuids((array) $object->entity_uuids) ->setTenant($object->tenant); $role = $this->getReference($object->role); @@ -48,17 +49,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/IndividualRole.php b/api/src/Fixture/IndividualRole.php index c49bd68..a44b5d7 100644 --- a/api/src/Fixture/IndividualRole.php +++ b/api/src/Fixture/IndividualRole.php @@ -39,6 +39,7 @@ public function load(ObjectManager $manager) ->setUuid($object->uuid) ->setOwner($object->owner) ->setOwnerUuid($object->owner_uuid) + ->setEntityUuids((array) $object->entity_uuids) ->setTenant($object->tenant); $role = $this->getReference($object->role); @@ -48,17 +49,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/OrganizationRole.php b/api/src/Fixture/OrganizationRole.php index 6ece71c..2cd0d82 100644 --- a/api/src/Fixture/OrganizationRole.php +++ b/api/src/Fixture/OrganizationRole.php @@ -39,6 +39,7 @@ public function load(ObjectManager $manager) ->setUuid($object->uuid) ->setOwner($object->owner) ->setOwnerUuid($object->owner_uuid) + ->setEntityUuids((array) $object->entity_uuids) ->setTenant($object->tenant); $role = $this->getReference($object->role); @@ -48,17 +49,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/StaffRole.php b/api/src/Fixture/StaffRole.php index 5096afb..1cadeb9 100644 --- a/api/src/Fixture/StaffRole.php +++ b/api/src/Fixture/StaffRole.php @@ -39,6 +39,7 @@ public function load(ObjectManager $manager) ->setUuid($object->uuid) ->setOwner($object->owner) ->setOwnerUuid($object->owner_uuid) + ->setEntityUuids((array) $object->entity_uuids) ->setTenant($object->tenant); $role = $this->getReference($object->role); @@ -48,17 +49,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/SystemRole.php b/api/src/Fixture/SystemRole.php index c51428b..5970802 100644 --- a/api/src/Fixture/SystemRole.php +++ b/api/src/Fixture/SystemRole.php @@ -39,6 +39,7 @@ public function load(ObjectManager $manager) ->setUuid($object->uuid) ->setOwner($object->owner) ->setOwnerUuid($object->owner_uuid) + ->setEntityUuids((array) $object->entity_uuids) ->setTenant($object->tenant); $role = $this->getReference($object->role); @@ -48,17 +49,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 index 0f3121f..6cb1949 100644 --- a/api/src/Migration/Version0_19_0.php +++ b/api/src/Migration/Version0_19_0.php @@ -36,6 +36,111 @@ public function __construct(Version $version) 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'); } /** @@ -46,5 +151,95 @@ public function up(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'); } } 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 @@ +setStaff($staff) ->setOwner($object->owner) ->setOwnerUuid($object->owner_uuid) + ->setEntityUuids((array) $object->entity_uuids) ->setRole($role) ->setTenant($object->tenant); $manager->persist($staffRole); From e9bbe5b77a37809838ae2a8d755dffdbeba495fc Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Mon, 3 Aug 2020 12:51:40 -0400 Subject: [PATCH 07/27] Add business unit role entity and related resources --- .../fixtures/dev/business_unit/role.yml | 10 ++++ .../fixtures/test/business_unit/role.yml | 10 ++++ api/config/packages/api_platform.yaml | 7 +++ api/config/packages/ds_acl.yaml | 55 +++++++++++------- api/config/services.yaml | 5 ++ api/src/Entity/BusinessUnit.php | 10 ++++ api/src/Entity/BusinessUnitRole.php | 51 +++++++++++++++++ api/src/Fixture/BusinessUnitRole.php | 57 +++++++++++++++++++ api/src/Fixture/BusinessUnitRoleFixture.php | 33 +++++++++++ api/src/Migration/Version0_19_0.php | 8 +++ .../Repository/BusinessUnitRoleRepository.php | 10 ++++ api/src/Service/BusinessUnitRoleService.php | 24 ++++++++ 12 files changed, 260 insertions(+), 20 deletions(-) create mode 100644 api/config/fixtures/dev/business_unit/role.yml create mode 100644 api/config/fixtures/test/business_unit/role.yml create mode 100644 api/src/Entity/BusinessUnitRole.php create mode 100644 api/src/Fixture/BusinessUnitRole.php create mode 100644 api/src/Fixture/BusinessUnitRoleFixture.php create mode 100644 api/src/Repository/BusinessUnitRoleRepository.php create mode 100644 api/src/Service/BusinessUnitRoleService.php diff --git a/api/config/fixtures/dev/business_unit/role.yml b/api/config/fixtures/dev/business_unit/role.yml new file mode 100644 index 0000000..3c8f708 --- /dev/null +++ b/api/config/fixtures/dev/business_unit/role.yml @@ -0,0 +1,10 @@ +objects: [] + +prototype: + business_unit: ~ + uuid: ~ + owner: BusinessUnit + owner_uuid: ~ + role: ~ + entity_uuids: [] + tenant: e5a2120d-6bf7-4c58-a900-bac1e55e986b # Tenant 1 diff --git a/api/config/fixtures/test/business_unit/role.yml b/api/config/fixtures/test/business_unit/role.yml new file mode 100644 index 0000000..8595a4f --- /dev/null +++ b/api/config/fixtures/test/business_unit/role.yml @@ -0,0 +1,10 @@ +objects: [] + +prototype: + business_unit: ~ + uuid: ~ + owner: BusinessUnit + owner_uuid: ~ + role: ~ + entity_uuids: [] + tenant: ~ diff --git a/api/config/packages/api_platform.yaml b/api/config/packages/api_platform.yaml index 87576a4..ab6d003 100644 --- a/api/config/packages/api_platform.yaml +++ b/api/config/packages/api_platform.yaml @@ -133,6 +133,13 @@ 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: + - businessUnit.uuid: exact + tags: + - { name: api_platform.filter, id: app.business_unit_role.search } + app.filter.individual.search: parent: api_platform.doctrine.orm.search_filter arguments: diff --git a/api/config/packages/ds_acl.yaml b/api/config/packages/ds_acl.yaml index 390a146..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_entity_uuids: { attributes: [BROWSE, READ, EDIT], property: App\Entity\AnonymousRole.entity_uuids, title: app.permissions.anonymous_role.entity_uuids } + 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_entity_uuids: { attributes: [BROWSE, READ, EDIT], property: App\Entity\IndividualRole.entity_uuids, title: app.permissions.individual_role.entity_uuids } + 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_entity_uuids: { attributes: [BROWSE, READ, EDIT], property: App\Entity\OrganizationRole.entity_uuids, title: app.permissions.organization_role.entity_uuids } + 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_entity_uuids: { attributes: [BROWSE, READ, EDIT], property: App\Entity\StaffRole.entity_uuids, title: app.permissions.staff_role.entity_uuids } + 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_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_entity_uuids: { attributes: [BROWSE, READ, EDIT], property: App\Entity\SystemRole.entity_uuids, title: app.permissions.system_role.entity_uuids } + 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/src/Entity/BusinessUnit.php b/api/src/Entity/BusinessUnit.php index d05d2dd..32ebee9 100644 --- a/api/src/Entity/BusinessUnit.php +++ b/api/src/Entity/BusinessUnit.php @@ -160,6 +160,15 @@ class BusinessUnit implements Identifiable, Uuidentifiable, Ownable, Translatabl */ private $staffs; + /** + * @var \Doctrine\Common\Collections\ArrayCollection + * @ApiProperty(writable=false) + * @Serializer\Groups({"business_unit_output"}) + * @ORM\OneToMany(targetEntity="BusinessUnitRole", mappedBy="businessUnit", cascade={"persist", "remove"}) + * @ORM\Cache(usage="NONSTRICT_READ_WRITE") + */ + private $roles; + /** * @var integer * @ApiProperty @@ -188,5 +197,6 @@ public function __construct() $this->title = []; $this->data = []; $this->staffs = new ArrayCollection; + $this->roles = new ArrayCollection; } } diff --git a/api/src/Entity/BusinessUnitRole.php b/api/src/Entity/BusinessUnitRole.php new file mode 100644 index 0000000..7fff560 --- /dev/null +++ b/api/src/Entity/BusinessUnitRole.php @@ -0,0 +1,51 @@ +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); + + $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/Migration/Version0_19_0.php b/api/src/Migration/Version0_19_0.php index 6cb1949..6d0c501 100644 --- a/api/src/Migration/Version0_19_0.php +++ b/api/src/Migration/Version0_19_0.php @@ -141,6 +141,14 @@ public function up(Schema $schema) $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'); } /** diff --git a/api/src/Repository/BusinessUnitRoleRepository.php b/api/src/Repository/BusinessUnitRoleRepository.php new file mode 100644 index 0000000..6de6af3 --- /dev/null +++ b/api/src/Repository/BusinessUnitRoleRepository.php @@ -0,0 +1,10 @@ + Date: Mon, 3 Aug 2020 12:57:27 -0400 Subject: [PATCH 08/27] Update migration 0_19_0 down method --- api/src/Migration/Version0_19_0.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/src/Migration/Version0_19_0.php b/api/src/Migration/Version0_19_0.php index 6d0c501..5664d0c 100644 --- a/api/src/Migration/Version0_19_0.php +++ b/api/src/Migration/Version0_19_0.php @@ -249,5 +249,7 @@ public function down(Schema $schema) $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'); } } From 86d99351713c50a9238e25d230a820b3432665d4 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Mon, 3 Aug 2020 13:03:34 -0400 Subject: [PATCH 09/27] Fix yaml extension typo --- api/config/fixtures/dev/business_unit/{role.yml => role.yaml} | 0 api/config/fixtures/test/business_unit/{role.yml => role.yaml} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename api/config/fixtures/dev/business_unit/{role.yml => role.yaml} (100%) rename api/config/fixtures/test/business_unit/{role.yml => role.yaml} (100%) diff --git a/api/config/fixtures/dev/business_unit/role.yml b/api/config/fixtures/dev/business_unit/role.yaml similarity index 100% rename from api/config/fixtures/dev/business_unit/role.yml rename to api/config/fixtures/dev/business_unit/role.yaml diff --git a/api/config/fixtures/test/business_unit/role.yml b/api/config/fixtures/test/business_unit/role.yaml similarity index 100% rename from api/config/fixtures/test/business_unit/role.yml rename to api/config/fixtures/test/business_unit/role.yaml From 2d302dc4d39c3d8afbd07c7883a9362d0106947c Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Mon, 3 Aug 2020 15:31:17 -0400 Subject: [PATCH 10/27] Add necessary api filter on business unit role endpoint for security token roles listener --- api/config/packages/api_platform.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/api/config/packages/api_platform.yaml b/api/config/packages/api_platform.yaml index ab6d003..98a46d0 100644 --- a/api/config/packages/api_platform.yaml +++ b/api/config/packages/api_platform.yaml @@ -137,6 +137,7 @@ services: parent: api_platform.doctrine.orm.search_filter arguments: - businessUnit.uuid: exact + businessUnit.staffs.uuid: exact tags: - { name: api_platform.filter, id: app.business_unit_role.search } From bbd308fff3c5a82e4e2da8ddd68bcf233b6448f7 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Mon, 3 Aug 2020 16:40:22 -0400 Subject: [PATCH 11/27] Update to latest digitalstate/core dependency --- api/composer.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/composer.lock b/api/composer.lock index 155b73f..32496b3 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "4c2371640e087c2490231085d8df7f9109e9bda3" + "reference": "f2a5b5972e56266978e44bfde920ed726357739a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/4c2371640e087c2490231085d8df7f9109e9bda3", - "reference": "4c2371640e087c2490231085d8df7f9109e9bda3", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/f2a5b5972e56266978e44bfde920ed726357739a", + "reference": "f2a5b5972e56266978e44bfde920ed726357739a", "shasum": "" }, "require": { From 6434d014d4bedc5d10e881b04582aa782808b7d7 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Mon, 3 Aug 2020 20:15:54 -0400 Subject: [PATCH 12/27] Remove unused entity accessor --- api/src/Entity/BusinessUnit.php | 1 - 1 file changed, 1 deletion(-) diff --git a/api/src/Entity/BusinessUnit.php b/api/src/Entity/BusinessUnit.php index 32ebee9..4e1b210 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; From 16a80c17ada303e837b688e09d345e63217334da Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Mon, 3 Aug 2020 20:28:37 -0400 Subject: [PATCH 13/27] Add api filters for assigned role entities --- api/config/packages/api_platform.yaml | 200 ++++++++++++++++++++++---- 1 file changed, 169 insertions(+), 31 deletions(-) diff --git a/api/config/packages/api_platform.yaml b/api/config/packages/api_platform.yaml index 98a46d0..5560b63 100644 --- a/api/config/packages/api_platform.yaml +++ b/api/config/packages/api_platform.yaml @@ -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 @@ -134,12 +157,35 @@ services: - { name: api_platform.filter, id: app.business_unit.order } app.filter.business_unit_role.search: - parent: api_platform.doctrine.orm.search_filter - arguments: - - businessUnit.uuid: exact - businessUnit.staffs.uuid: exact - tags: - - { name: api_platform.filter, id: app.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 @@ -210,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 @@ -285,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 @@ -400,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 @@ -437,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 } From 0732b0ef3c403d1db272eb99623a61c01c9a2975 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Wed, 5 Aug 2020 18:49:11 -0400 Subject: [PATCH 14/27] Refactor role validation and propagation --- api/src/Service/RoleService.php | 7 +- .../Constraints/Role/Permissions/Valid.php | 51 ----- .../Role/Permissions/ValidValidator.php | 192 ++++++++---------- 3 files changed, 86 insertions(+), 164 deletions(-) diff --git a/api/src/Service/RoleService.php b/api/src/Service/RoleService.php index 4203ea1..e9e146e 100644 --- a/api/src/Service/RoleService.php +++ b/api/src/Service/RoleService.php @@ -79,13 +79,8 @@ public function createAccess(Role $role) foreach ($servicePermissions as $servicePermission) { foreach ($servicePermission['permissions'] as $entry) { $permission = new Permission; - $scope = new Scope; - $scope - ->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/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..1f4c1c7 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" + }, + "entityUuid": { + "type": ["string", "null"] + }, + "property": { + "type": "string" + }, + "comparison": { + "type": "string", + "enum": ["eq", "neq"] + }, + "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(); + } } } } From 2050bfc8e3e89f2f5ca8b461488cf65a5f3c7820 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Wed, 5 Aug 2020 18:54:52 -0400 Subject: [PATCH 15/27] Update digitalstate/core dependency --- api/composer.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/composer.lock b/api/composer.lock index 32496b3..a1b71ab 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "f2a5b5972e56266978e44bfde920ed726357739a" + "reference": "7ffdb4a9d467390862d0bd223447893e5b206df0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/f2a5b5972e56266978e44bfde920ed726357739a", - "reference": "f2a5b5972e56266978e44bfde920ed726357739a", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/7ffdb4a9d467390862d0bd223447893e5b206df0", + "reference": "7ffdb4a9d467390862d0bd223447893e5b206df0", "shasum": "" }, "require": { From 7d920bfc8e90f6d5468251fc1f903f2b045ac6f4 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Thu, 6 Aug 2020 17:42:20 -0400 Subject: [PATCH 16/27] Update to latest digitalstate/core dependency --- api/composer.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/composer.lock b/api/composer.lock index a1b71ab..3969d88 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "7ffdb4a9d467390862d0bd223447893e5b206df0" + "reference": "ac3da6f8fd4e79933769f01253ab96d552b33776" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/7ffdb4a9d467390862d0bd223447893e5b206df0", - "reference": "7ffdb4a9d467390862d0bd223447893e5b206df0", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/ac3da6f8fd4e79933769f01253ab96d552b33776", + "reference": "ac3da6f8fd4e79933769f01253ab96d552b33776", "shasum": "" }, "require": { From a2348ab8fea566030b461a34fbb1f351fd9576e9 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 9 Aug 2020 21:19:12 -0400 Subject: [PATCH 17/27] Update to latest digitalstate/core dependency --- api/composer.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/composer.lock b/api/composer.lock index 3969d88..b583612 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "ac3da6f8fd4e79933769f01253ab96d552b33776" + "reference": "43e1155fae8e6610964893b0fe520de8848abd3a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/ac3da6f8fd4e79933769f01253ab96d552b33776", - "reference": "ac3da6f8fd4e79933769f01253ab96d552b33776", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/43e1155fae8e6610964893b0fe520de8848abd3a", + "reference": "43e1155fae8e6610964893b0fe520de8848abd3a", "shasum": "" }, "require": { From 6358021c932b471b3bf8bcd20ec3c07de01c5128 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Fri, 21 Aug 2020 06:51:32 -0400 Subject: [PATCH 18/27] Update role validation constraints --- .../Validator/Constraints/Role/Permissions/ValidValidator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/Validator/Constraints/Role/Permissions/ValidValidator.php b/api/src/Validator/Constraints/Role/Permissions/ValidValidator.php index 1f4c1c7..5d16369 100644 --- a/api/src/Validator/Constraints/Role/Permissions/ValidValidator.php +++ b/api/src/Validator/Constraints/Role/Permissions/ValidValidator.php @@ -85,7 +85,7 @@ public function validate($role, Constraint $constraint) "entity": { "type": "string" }, - "entityUuid": { + "entity_uuid": { "type": ["string", "null"] }, "property": { @@ -93,7 +93,7 @@ public function validate($role, Constraint $constraint) }, "comparison": { "type": "string", - "enum": ["eq", "neq"] + "enum": ["eq", "neq", "like"] }, "value": {} } From 86ad5557dabe5b1f1a2382be54a7802e34eba36f Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 23 Aug 2020 11:31:01 -0400 Subject: [PATCH 19/27] Update role validation constraints --- .../Validator/Constraints/Role/Permissions/ValidValidator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/Validator/Constraints/Role/Permissions/ValidValidator.php b/api/src/Validator/Constraints/Role/Permissions/ValidValidator.php index 5d16369..ab21919 100644 --- a/api/src/Validator/Constraints/Role/Permissions/ValidValidator.php +++ b/api/src/Validator/Constraints/Role/Permissions/ValidValidator.php @@ -83,7 +83,7 @@ public function validate($role, Constraint $constraint) "enum": ["generic", "object", "identity", "owner", "session", "property"] }, "entity": { - "type": "string" + "type": ["string", "null"] }, "entity_uuid": { "type": ["string", "null"] From e6318b1a4f46859365066c1cd64f3deaa29b2984 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 30 Aug 2020 14:33:03 -0400 Subject: [PATCH 20/27] Enable write on entity created_at properties --- api/composer.lock | 6 +++--- api/docker/php/docker-entrypoint.sh | 4 ++-- api/features/api/access/add.feature | 2 ++ api/features/api/access/edit.feature | 6 +++--- api/features/api/config/edit.feature | 6 +++--- api/features/api/identity/anonymous/add.feature | 2 ++ api/features/api/identity/anonymous/edit.feature | 6 +++--- api/features/api/identity/individual/add.feature | 2 ++ api/features/api/identity/individual/edit.feature | 6 +++--- api/features/api/identity/organization/add.feature | 2 ++ api/features/api/identity/organization/edit.feature | 6 +++--- api/features/api/identity/staff/add.feature | 2 ++ api/features/api/identity/staff/edit.feature | 6 +++--- api/features/api/identity/system/add.feature | 2 ++ api/features/api/identity/system/edit.feature | 6 +++--- api/features/api/metadata/add.feature | 2 ++ api/features/api/metadata/edit.feature | 6 +++--- api/src/Entity/Anonymous.php | 5 +++-- api/src/Entity/AssignedRole.php | 5 +++-- api/src/Entity/BusinessUnit.php | 5 +++-- api/src/Entity/Individual.php | 5 +++-- api/src/Entity/Organization.php | 5 +++-- api/src/Entity/Persona.php | 5 +++-- api/src/Entity/Role.php | 5 +++-- api/src/Entity/Staff.php | 5 +++-- api/src/Entity/System.php | 5 +++-- api/src/Fixture/Anonymous.php | 8 ++++++++ api/src/Fixture/AnonymousPersona.php | 8 ++++++++ api/src/Fixture/AnonymousRole.php | 7 +++++++ api/src/Fixture/BusinessUnit.php | 8 ++++++++ api/src/Fixture/BusinessUnitRole.php | 7 +++++++ api/src/Fixture/Individual.php | 8 ++++++++ api/src/Fixture/IndividualPersona.php | 8 ++++++++ api/src/Fixture/IndividualRole.php | 7 +++++++ api/src/Fixture/Organization.php | 8 ++++++++ api/src/Fixture/OrganizationPersona.php | 8 ++++++++ api/src/Fixture/OrganizationRole.php | 7 +++++++ api/src/Fixture/Role.php | 8 ++++++++ api/src/Fixture/Staff.php | 7 +++++++ api/src/Fixture/StaffPersona.php | 8 ++++++++ api/src/Fixture/StaffRole.php | 7 +++++++ api/src/Fixture/System.php | 8 ++++++++ api/src/Fixture/SystemRole.php | 7 +++++++ 43 files changed, 199 insertions(+), 47 deletions(-) diff --git a/api/composer.lock b/api/composer.lock index b583612..86aacef 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "43e1155fae8e6610964893b0fe520de8848abd3a" + "reference": "c762a4f7a9ed1815742564d7890f8652d65dc3d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/43e1155fae8e6610964893b0fe520de8848abd3a", - "reference": "43e1155fae8e6610964893b0fe520de8848abd3a", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/c762a4f7a9ed1815742564d7890f8652d65dc3d0", + "reference": "c762a4f7a9ed1815742564d7890f8652d65dc3d0", "shasum": "" }, "require": { diff --git a/api/docker/php/docker-entrypoint.sh b/api/docker/php/docker-entrypoint.sh index 95668d2..bf12dce 100644 --- a/api/docker/php/docker-entrypoint.sh +++ b/api/docker/php/docker-entrypoint.sh @@ -8,8 +8,8 @@ fi if [ "$1" = 'php-fpm' ] || [ "$1" = 'bin/console' ]; then mkdir -p var/cache var/log - setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX var - setfacl -dR -m u:www-data:rwX -m u:"$(whoami)":rwX var +# setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX var +# setfacl -dR -m u:www-data:rwX -m u:"$(whoami)":rwX var if [ "$APP_ENV" != 'prod' ]; then composer install --prefer-dist --no-progress --no-suggest --no-interaction diff --git a/api/features/api/access/add.feature b/api/features/api/access/add.feature index 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/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/AssignedRole.php b/api/src/Entity/AssignedRole.php index 2112765..147940c 100644 --- a/api/src/Entity/AssignedRole.php +++ b/api/src/Entity/AssignedRole.php @@ -56,8 +56,9 @@ abstract class AssignedRole implements Identifiable, Uuidentifiable, Ownable, Ve /** * @var \DateTime - * @ApiProperty(writable=false) - * @Serializer\Groups({"assigned_role_output"}) + * @ApiProperty + * @Serializer\Groups({"assigned_role_output", "assigned_role_input"}) + * @Assert\DateTime */ protected $createdAt; diff --git a/api/src/Entity/BusinessUnit.php b/api/src/Entity/BusinessUnit.php index 4e1b210..423cb0e 100644 --- a/api/src/Entity/BusinessUnit.php +++ b/api/src/Entity/BusinessUnit.php @@ -88,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; 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/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/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..4b6daef 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_intput"}) + * @Assert\DateTime */ protected $createdAt; 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/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 5d19149..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; @@ -42,6 +43,12 @@ public function load(ObjectManager $manager) ->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) { 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 index 52e9d2c..db66c06 100644 --- a/api/src/Fixture/BusinessUnitRole.php +++ b/api/src/Fixture/BusinessUnitRole.php @@ -3,6 +3,7 @@ namespace App\Fixture; use App\Entity\BusinessUnitRole as BusinessUnitRoleEntity; +use DateTime; use Doctrine\Common\Persistence\ObjectManager; use Ds\Component\Database\Fixture\Yaml; use LogicException; @@ -42,6 +43,12 @@ public function load(ObjectManager $manager) ->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) { 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 a44b5d7..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; @@ -42,6 +43,12 @@ public function load(ObjectManager $manager) ->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) { 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 2cd0d82..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; @@ -42,6 +43,12 @@ public function load(ObjectManager $manager) ->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) { 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 1cadeb9..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; @@ -42,6 +43,12 @@ public function load(ObjectManager $manager) ->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) { 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 5970802..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; @@ -42,6 +43,12 @@ public function load(ObjectManager $manager) ->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) { From 48ce719e61ce526ec089b39a39499ded12cf687e Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 30 Aug 2020 14:39:46 -0400 Subject: [PATCH 21/27] Enable write on entity created_at properties --- api/config/fixtures/test/system/tenant.yaml | 1 + 1 file changed, 1 insertion(+) 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: {} From 71c3a9e84e85a13e8e03fcdb73a422878b58e69f Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 30 Aug 2020 15:01:56 -0400 Subject: [PATCH 22/27] Enable write on entity created_at properties --- api/config/fixtures/dev/access/anonymous/access.yaml | 1 + api/config/fixtures/dev/access/individual/access.yaml | 1 + api/config/fixtures/dev/access/organization/access.yaml | 1 + api/config/fixtures/dev/access/role/access.yaml | 1 + api/config/fixtures/dev/access/staff/access.yaml | 1 + api/config/fixtures/dev/access/system/access.yaml | 1 + api/config/fixtures/dev/business_unit.yaml | 1 + api/config/fixtures/dev/business_unit/role.yaml | 1 + api/config/fixtures/dev/config.yaml | 1 + api/config/fixtures/dev/identity/anonymous/identity.yaml | 1 + api/config/fixtures/dev/identity/anonymous/persona.yaml | 1 + api/config/fixtures/dev/identity/anonymous/role.yaml | 1 + api/config/fixtures/dev/identity/individual/identity.yaml | 1 + api/config/fixtures/dev/identity/individual/persona.yaml | 1 + api/config/fixtures/dev/identity/individual/role.yaml | 1 + api/config/fixtures/dev/identity/organization/identity.yaml | 1 + api/config/fixtures/dev/identity/organization/persona.yaml | 1 + api/config/fixtures/dev/identity/organization/role.yaml | 1 + api/config/fixtures/dev/identity/staff/identity.yaml | 1 + api/config/fixtures/dev/identity/staff/persona.yaml | 1 + api/config/fixtures/dev/identity/staff/role.yaml | 1 + api/config/fixtures/dev/identity/system/identity.yaml | 1 + api/config/fixtures/dev/identity/system/role.yaml | 1 + api/config/fixtures/dev/metadata.yaml | 1 + api/config/fixtures/dev/role.yaml | 1 + api/config/fixtures/dev/system/tenant.yaml | 1 + api/config/fixtures/test/access/anonymous/access.yaml | 1 + api/config/fixtures/test/access/individual/access.yaml | 1 + api/config/fixtures/test/access/organization/access.yaml | 1 + api/config/fixtures/test/access/role/access.yaml | 1 + api/config/fixtures/test/access/staff/access.yaml | 1 + api/config/fixtures/test/access/system/access.yaml | 1 + api/config/fixtures/test/business_unit.yaml | 1 + api/config/fixtures/test/business_unit/role.yaml | 1 + api/config/fixtures/test/config.yaml | 1 + api/config/fixtures/test/identity/anonymous/identity.yaml | 1 + api/config/fixtures/test/identity/anonymous/persona.yaml | 1 + api/config/fixtures/test/identity/anonymous/role.yaml | 1 + api/config/fixtures/test/identity/individual/identity.yaml | 1 + api/config/fixtures/test/identity/individual/persona.yaml | 1 + api/config/fixtures/test/identity/individual/role.yaml | 1 + api/config/fixtures/test/identity/organization/identity.yaml | 1 + api/config/fixtures/test/identity/organization/persona.yaml | 1 + api/config/fixtures/test/identity/organization/role.yaml | 1 + api/config/fixtures/test/identity/staff/identity.yaml | 1 + api/config/fixtures/test/identity/staff/persona.yaml | 1 + api/config/fixtures/test/identity/staff/role.yaml | 1 + api/config/fixtures/test/identity/system/identity.yaml | 1 + api/config/fixtures/test/identity/system/role.yaml | 1 + api/config/fixtures/test/metadata.yaml | 1 + api/config/fixtures/test/role.yaml | 1 + 51 files changed, 51 insertions(+) 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/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 index 3c8f708..2b14a40 100644 --- a/api/config/fixtures/dev/business_unit/role.yaml +++ b/api/config/fixtures/dev/business_unit/role.yaml @@ -3,6 +3,7 @@ objects: [] prototype: business_unit: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ role: ~ 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 4639cc4..800d741 100644 --- a/api/config/fixtures/dev/identity/anonymous/role.yaml +++ b/api/config/fixtures/dev/identity/anonymous/role.yaml @@ -3,6 +3,7 @@ objects: [] prototype: anonymous: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ role: ~ 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 c53f27f..3d425a4 100644 --- a/api/config/fixtures/dev/identity/individual/role.yaml +++ b/api/config/fixtures/dev/identity/individual/role.yaml @@ -8,6 +8,7 @@ objects: prototype: individual: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: a9d68bf7-5000-49fe-8b00-33dde235b327 # Backoffice role: 54d82fc6-8ce7-498e-832f-3598664a9d9d # Individual 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 0cda068..8aa93c2 100644 --- a/api/config/fixtures/dev/identity/organization/role.yaml +++ b/api/config/fixtures/dev/identity/organization/role.yaml @@ -6,6 +6,7 @@ objects: prototype: organization: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: a9d68bf7-5000-49fe-8b00-33dde235b327 # Backoffice role: ~ 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 e6d14ff..45348df 100644 --- a/api/config/fixtures/dev/identity/staff/role.yaml +++ b/api/config/fixtures/dev/identity/staff/role.yaml @@ -19,6 +19,7 @@ objects: prototype: staff: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: a9d68bf7-5000-49fe-8b00-33dde235b327 # Backoffice role: ~ 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 97d261f..83c4de2 100644 --- a/api/config/fixtures/dev/identity/system/role.yaml +++ b/api/config/fixtures/dev/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/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 index 8595a4f..161f5b9 100644 --- a/api/config/fixtures/test/business_unit/role.yaml +++ b/api/config/fixtures/test/business_unit/role.yaml @@ -3,6 +3,7 @@ objects: [] prototype: business_unit: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ role: ~ 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 b28cbe3..70e8141 100644 --- a/api/config/fixtures/test/identity/anonymous/role.yaml +++ b/api/config/fixtures/test/identity/anonymous/role.yaml @@ -3,6 +3,7 @@ objects: [] prototype: anonymous: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ role: ~ 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 1449776..e9969cb 100644 --- a/api/config/fixtures/test/identity/individual/role.yaml +++ b/api/config/fixtures/test/identity/individual/role.yaml @@ -3,6 +3,7 @@ objects: [] prototype: individual: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ role: ~ 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 aa257de..95e98bf 100644 --- a/api/config/fixtures/test/identity/organization/role.yaml +++ b/api/config/fixtures/test/identity/organization/role.yaml @@ -3,6 +3,7 @@ objects: [] prototype: organization: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ role: ~ 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 654244a..e423e0b 100644 --- a/api/config/fixtures/test/identity/staff/role.yaml +++ b/api/config/fixtures/test/identity/staff/role.yaml @@ -3,6 +3,7 @@ objects: [] prototype: staff: ~ uuid: ~ + created_at: ~ owner: BusinessUnit owner_uuid: ~ role: ~ 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: {} From dd4b43eb014fbf27752a08f7083666b856c725b5 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sun, 30 Aug 2020 15:21:47 -0400 Subject: [PATCH 23/27] Enable write on entity created_at properties --- api/features/api/system/tenant/add.feature | 2 ++ api/src/Entity/Staff.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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/Staff.php b/api/src/Entity/Staff.php index 4b6daef..c953b83 100644 --- a/api/src/Entity/Staff.php +++ b/api/src/Entity/Staff.php @@ -86,7 +86,7 @@ class Staff implements Identifiable, Uuidentifiable, Ownable, Identitiable, Dele /** * @var \DateTime * @ApiProperty - * @Serializer\Groups({"staff_output", "staff_intput"}) + * @Serializer\Groups({"staff_output", "staff_input"}) * @Assert\DateTime */ protected $createdAt; From 1a7b241f3f234fd550b46a3ce74175ad1293de2b Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Mon, 31 Aug 2020 06:42:57 -0400 Subject: [PATCH 24/27] Fix var directory permissions --- api/docker/php/docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/docker/php/docker-entrypoint.sh b/api/docker/php/docker-entrypoint.sh index bf12dce..95668d2 100644 --- a/api/docker/php/docker-entrypoint.sh +++ b/api/docker/php/docker-entrypoint.sh @@ -8,8 +8,8 @@ fi if [ "$1" = 'php-fpm' ] || [ "$1" = 'bin/console' ]; then mkdir -p var/cache var/log -# setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX var -# setfacl -dR -m u:www-data:rwX -m u:"$(whoami)":rwX var + setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX var + setfacl -dR -m u:www-data:rwX -m u:"$(whoami)":rwX var if [ "$APP_ENV" != 'prod' ]; then composer install --prefer-dist --no-progress --no-suggest --no-interaction From cfb6f78ceb064570ca884bcb372fa27e3f716207 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Wed, 16 Sep 2020 19:44:27 -0400 Subject: [PATCH 25/27] Update composer dependencies --- api/composer.json | 1 + api/composer.lock | 145 +++++++++++++++++++++++----------------------- 2 files changed, 74 insertions(+), 72 deletions(-) diff --git a/api/composer.json b/api/composer.json index cc83193..5722161 100644 --- a/api/composer.json +++ b/api/composer.json @@ -15,6 +15,7 @@ "doctrine/doctrine-fixtures-bundle": "^3.0", "doctrine/doctrine-migrations-bundle": "^1.3", "guzzlehttp/guzzle": "^6.3", + "justinrainbow/json-schema": "^5.0", "knplabs/doctrine-behaviors": "^1.5", "lexik/jwt-authentication-bundle": "^2.6", "ramsey/uuid": "^3.8", diff --git a/api/composer.lock b/api/composer.lock index 86aacef..da23014 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a8c3c03ed890d64b69c7a84d2ec08344", + "content-hash": "a30801307d3efc8e93c107e03b97795d", "packages": [ { "name": "api-platform/api-pack", @@ -334,12 +334,12 @@ "source": { "type": "git", "url": "https://github.com/DigitalState/Core.git", - "reference": "c762a4f7a9ed1815742564d7890f8652d65dc3d0" + "reference": "ddd320c3aacb7c5e7bdb962b5d2715abcb1dd9d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DigitalState/Core/zipball/c762a4f7a9ed1815742564d7890f8652d65dc3d0", - "reference": "c762a4f7a9ed1815742564d7890f8652d65dc3d0", + "url": "https://api.github.com/repos/DigitalState/Core/zipball/ddd320c3aacb7c5e7bdb962b5d2715abcb1dd9d2", + "reference": "ddd320c3aacb7c5e7bdb962b5d2715abcb1dd9d2", "shasum": "" }, "require": { @@ -1947,6 +1947,72 @@ ], "time": "2014-01-12T16:20:24+00:00" }, + { + "name": "justinrainbow/json-schema", + "version": "5.2.10", + "source": { + "type": "git", + "url": "https://github.com/justinrainbow/json-schema.git", + "reference": "2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b", + "reference": "2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", + "json-schema/json-schema-test-suite": "1.2.0", + "phpunit/phpunit": "^4.8.35" + }, + "bin": [ + "bin/validate-json" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "JsonSchema\\": "src/JsonSchema/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bruno Prieto Reis", + "email": "bruno.p.reis@gmail.com" + }, + { + "name": "Justin Rainbow", + "email": "justin.rainbow@gmail.com" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, + { + "name": "Robert Schönthal", + "email": "seroscho@googlemail.com" + } + ], + "description": "A library to validate a json schema.", + "homepage": "https://github.com/justinrainbow/json-schema", + "keywords": [ + "json", + "schema" + ], + "time": "2020-05-27T16:41:55+00:00" + }, { "name": "knplabs/doctrine-behaviors", "version": "1.6.0", @@ -7000,6 +7066,7 @@ ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", "homepage": "https://github.com/container-interop/container-interop", + "abandoned": "psr/container", "time": "2017-02-14T19:40:03+00:00" }, { @@ -7007,12 +7074,12 @@ "version": "0.9.1", "source": { "type": "git", - "url": "https://github.com/njh/easyrdf.git", + "url": "https://github.com/easyrdf/easyrdf.git", "reference": "acd09dfe0555fbcfa254291e433c45fdd4652566" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/njh/easyrdf/zipball/acd09dfe0555fbcfa254291e433c45fdd4652566", + "url": "https://api.github.com/repos/easyrdf/easyrdf/zipball/acd09dfe0555fbcfa254291e433c45fdd4652566", "reference": "acd09dfe0555fbcfa254291e433c45fdd4652566", "shasum": "" }, @@ -7160,72 +7227,6 @@ "description": "A tool to automatically fix PHP code style", "time": "2019-01-04T18:29:47+00:00" }, - { - "name": "justinrainbow/json-schema", - "version": "5.2.8", - "source": { - "type": "git", - "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/dcb6e1006bb5fd1e392b4daa68932880f37550d4", - "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~2.2.20", - "json-schema/json-schema-test-suite": "1.2.0", - "phpunit/phpunit": "^4.8.35" - }, - "bin": [ - "bin/validate-json" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "JsonSchema\\": "src/JsonSchema/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bruno Prieto Reis", - "email": "bruno.p.reis@gmail.com" - }, - { - "name": "Justin Rainbow", - "email": "justin.rainbow@gmail.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - }, - { - "name": "Robert Schönthal", - "email": "seroscho@googlemail.com" - } - ], - "description": "A library to validate a json schema.", - "homepage": "https://github.com/justinrainbow/json-schema", - "keywords": [ - "json", - "schema" - ], - "time": "2019-01-14T23:55:14+00:00" - }, { "name": "league/html-to-markdown", "version": "4.8.1", From a205652ad42155cbafe014b0adfdd18e5a28947b Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Sat, 31 Oct 2020 17:01:37 -0400 Subject: [PATCH 26/27] Set composer version in dockerfile --- api/Dockerfile-php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/Dockerfile-php b/api/Dockerfile-php index e316e63..18474ad 100644 --- a/api/Dockerfile-php +++ b/api/Dockerfile-php @@ -46,7 +46,7 @@ RUN set -eux; \ \ apk del .build-deps -COPY --from=composer:latest /usr/bin/composer /usr/bin/composer +COPY --from=composer:1.10.16 /usr/bin/composer /usr/bin/composer COPY docker/php/php.ini /usr/local/etc/php/php.ini # https://getcomposer.org/doc/03-cli.md#composer-allow-superuser From a9dd8b2295adca1d58a09903a2cfb94543965027 Mon Sep 17 00:00:00 2001 From: marioprudhomme Date: Tue, 2 Feb 2021 19:13:52 -0500 Subject: [PATCH 27/27] Remove deprecated dependency checker service --- .travis.yml | 1 - api/composer.json | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5b9cc6a..4fce1a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,6 @@ before_install: script: - docker-compose -f docker-compose.yml -f docker-compose.test.yml up -d - while true; do output=`docker-compose exec -T php pidof php-fpm | cat`; if [[ ! -z "${output}" ]]; then break; fi; sleep 1; done; - - docker-compose -f docker-compose.yml -f docker-compose.test.yml exec php php bin/console security:check - docker-compose -f docker-compose.yml -f docker-compose.test.yml exec php php bin/console doctrine:migration:migrate --no-interaction - docker-compose -f docker-compose.yml -f docker-compose.test.yml exec -e FIXTURES=test php php bin/console doctrine:fixtures:load --no-interaction - docker-compose -f docker-compose.yml -f docker-compose.test.yml exec php vendor/bin/behat diff --git a/api/composer.json b/api/composer.json index 5722161..8045fc0 100644 --- a/api/composer.json +++ b/api/composer.json @@ -68,8 +68,7 @@ "auto-scripts": { "cache:clear": "symfony-cmd", "assets:install": "symfony-cmd", - "assets:install %PUBLIC_DIR%": "symfony-cmd", - "security-checker security:check": "script" + "assets:install %PUBLIC_DIR%": "symfony-cmd" }, "post-install-cmd": [ "@auto-scripts"