diff --git a/composer.json b/composer.json index 698cd572465b7c4b241eeac3a422ba55aee2c5f7..f81387a5ef4db2ad69b8aa28ccbcf901eb07bed0 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "php": ">=7.3", "ext-json": "*", "api-platform/core": "^2.6.3", - "dbp/relay-core-bundle": "^0.1.75", + "dbp/relay-core-bundle": "^0.1.88", "guzzlehttp/guzzle": "^7.0", "nelmio/cors-bundle": "^2.1.0", "phpdocumentor/reflection-docblock": "^3.0 || ^4.0 || ^5.0", @@ -31,12 +31,6 @@ "symfony/phpunit-bridge": "^5.2", "vimeo/psalm": "^4.4" }, - "repositories": [ - { - "type": "vcs", - "url": "git@gitlab.tugraz.at:dbp/relay/dbp-relay-core-bundle.git" - } - ], "autoload": { "psr-4": { "Dbp\\Relay\\BasePersonBundle\\": "src/" diff --git a/composer.lock b/composer.lock index 4840f372c18e9880e4532a9c5054acd0e44baced..c87a6de51a704d18691503243588fa79e1b6d15d 100644 --- a/composer.lock +++ b/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": "cec90c82e15b22b04126f03784eae38f", + "content-hash": "4fc79f39b1258770790c8bd2d9761812", "packages": [ { "name": "api-platform/core", @@ -169,16 +169,16 @@ }, { "name": "dbp/relay-core-bundle", - "version": "v0.1.82", + "version": "v0.1.88", "source": { "type": "git", - "url": "https://gitlab.tugraz.at/dbp/relay/dbp-relay-core-bundle.git", - "reference": "26b368389e5996a52a4afe7f718365e33bd16f91" + "url": "https://github.com/digital-blueprint/relay-core-bundle.git", + "reference": "3da7929f4f8efb6bd6cef0fbd9a64bb2d5c7e407" }, "dist": { "type": "zip", - "url": "https://gitlab.tugraz.at/api/v4/projects/dbp%2Frelay%2Fdbp-relay-core-bundle/repository/archive.zip?sha=26b368389e5996a52a4afe7f718365e33bd16f91", - "reference": "26b368389e5996a52a4afe7f718365e33bd16f91", + "url": "https://api.github.com/repos/digital-blueprint/relay-core-bundle/zipball/3da7929f4f8efb6bd6cef0fbd9a64bb2d5c7e407", + "reference": "3da7929f4f8efb6bd6cef0fbd9a64bb2d5c7e407", "shasum": "" }, "require": { @@ -239,51 +239,16 @@ "Dbp\\Relay\\CoreBundle\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "Dbp\\Relay\\CoreBundle\\Tests\\": "tests/" - } - }, - "scripts": { - "post-install-cmd": [ - "cghooks add --ignore-lock" - ], - "post-update-cmd": [ - "cghooks update" - ], - "test": [ - "@php vendor/bin/phpunit" - ], - "phpstan": [ - "@php vendor/bin/phpstan analyze --ansi" - ], - "psalm": [ - "@php vendor/bin/psalm" - ], - "lint": [ - "@composer run cs", - "@composer run phpstan", - "@composer run psalm" - ], - "cs-fix": [ - "@php vendor/bin/php-cs-fixer --ansi fix" - ], - "cs": [ - "@php vendor/bin/php-cs-fixer --ansi fix --dry-run --diff" - ], - "coverage": [ - "@php -dxdebug.mode=coverage vendor/bin/phpunit --coverage-html _coverage" - ] - }, + "notification-url": "https://packagist.org/downloads/", "license": [ "AGPL-3.0-or-later" ], "description": "The core bundle of the Relay API gateway", "support": { - "source": "https://gitlab.tugraz.at/dbp/relay/dbp-relay-core-bundle/-/tree/v0.1.82", - "issues": "https://gitlab.tugraz.at/dbp/relay/dbp-relay-core-bundle/-/issues" + "issues": "https://github.com/digital-blueprint/relay-core-bundle/issues", + "source": "https://github.com/digital-blueprint/relay-core-bundle/tree/v0.1.88" }, - "time": "2023-02-23T15:58:31+01:00" + "time": "2023-02-28T11:30:57+00:00" }, { "name": "doctrine/annotations", @@ -10138,5 +10103,5 @@ "platform-overrides": { "php": "7.3" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.2.0" } diff --git a/src/Authorization/AuthorizationService.php b/src/Authorization/PersonNormalizer.php similarity index 55% rename from src/Authorization/AuthorizationService.php rename to src/Authorization/PersonNormalizer.php index 0765a7f35f8ba0ce305badcb7f51474fcb57767f..dd06e63725a2aeb5cb03565c5fedc2ef4e0b33ea 100644 --- a/src/Authorization/AuthorizationService.php +++ b/src/Authorization/PersonNormalizer.php @@ -5,21 +5,21 @@ declare(strict_types=1); namespace Dbp\Relay\BasePersonBundle\Authorization; use Dbp\Relay\BasePersonBundle\Entity\Person; -use Dbp\Relay\CoreBundle\Authorization\AbstractAuthorizationService; use Dbp\Relay\CoreBundle\Authorization\AuthorizationConfigDefinition; +use Dbp\Relay\CoreBundle\Authorization\Serializer\AbstractEntityDeNormalizer; -class AuthorizationService extends AbstractAuthorizationService +class PersonNormalizer extends AbstractEntityDeNormalizer { public function __construct() { - $isLoggedInUserExpression = 'user.getIdentifier() == entity.getIdentifier()'; + $isCurrentlyLoggedInUserExpression = 'user.getIdentifier() == entity.getIdentifier()'; - $this->configure([], [], [ + $this->configureEntities([ 'BasePerson' => [ AuthorizationConfigDefinition::ENTITY_CLASS_NAME_CONFIG_NODE => Person::class, AuthorizationConfigDefinition::ENTITY_READ_ACCESS_CONFIG_NODE => [ - 'email' => $isLoggedInUserExpression, - 'birthDate' => $isLoggedInUserExpression, + 'email' => $isCurrentlyLoggedInUserExpression, + 'birthDate' => $isCurrentlyLoggedInUserExpression, ], ], ]); diff --git a/src/Resources/config/services.yaml b/src/Resources/config/services.yaml index 7f6a9f3cf6e30100435f338c495b1dbdc7fe104e..c3b2bf61446da8fb0d0a7f628370faf1c12fc204 100644 --- a/src/Resources/config/services.yaml +++ b/src/Resources/config/services.yaml @@ -10,7 +10,7 @@ services: autowire: true autoconfigure: true - Dbp\Relay\BasePersonBundle\Authorization\AuthorizationService: + Dbp\Relay\BasePersonBundle\Authorization\PersonNormalizer: autowire: true autoconfigure: true