dbp / relay-core-connector-textfile-bundle
A template bundle for the Relay API gateway
Installs: 6 469
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 1
Type:symfony-bundle
Requires
- php: >=8.1
- ext-json: *
- api-platform/core: ^2.7.11 || ^3.2
- dbp/relay-core-bundle: ^0.1.168
- symfony/config: ^5.4 || ^6.4
- symfony/dependency-injection: ^5.4 || ^6.4
- symfony/framework-bundle: ^5.4 || ^6.4
- symfony/http-kernel: ^5.4 || ^6.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.50
- phpstan/phpstan: ^1.10.59
- phpstan/phpstan-phpunit: ^1.3.16
- phpstan/phpstan-symfony: ^1.3.7
- phpunit/phpunit: ^9.6.17
- symfony/browser-kit: ^5.4 || ^6.4
- symfony/http-client: ^5.4 || ^6.4
- symfony/monolog-bundle: ^3.10
- symfony/phpunit-bridge: ^5.4 || ^6.4
- vimeo/psalm: ^5.22.2
README
The core_connector_textfile bundle provides an implementation of the AuthorizationDataProviderInterface
which retrieves user attributes used for access control from the bundle's config file.
Bundle installation
You can install the bundle directly from packagist.org.
composer require dbp/relay-core-connector-textfile-bundle
Integration into the Relay API Server
- Add the bundle to your
config/bundles.php
in front ofDbpRelayCoreBundle
:
... Dbp\Relay\CoreConnectorTextfileBundle\DbpRelayCoreConnectorTextfileBundle::class => ['all' => true], Dbp\Relay\CoreBundle\DbpRelayCoreBundle::class => ['all' => true], ];
If you were using the DBP API Server Template as template for your Symfony application, then this should have already been generated for you.
- Run
composer install
to clear caches
Configuration
User authorization attributes can be defined using the bundle config. For this create config/packages/dbp_relay_core_connector_textfile.yaml
.
Here is an example config file:
dbp_relay_core_connector_textfile: # used to define groups used for the attribute mapping groups: - name: DEVELOPERS users: - junior - senior # used to declare available attributes attributes: - name: ROLE_DEVELOPER default_value: false # default value: 'null' for scalar and '[]' for array attributes - name: ORGANIZATION_UNITS array: true # default value: 'false' # used to define values for the attributes # each mapping entry specifies a value for an attribute for one or many users and/or groups attribute_mapping: - name: ROLE_DEVELOPER groups: - DEVELOPERS value: true - name ORGANIZATION_UNITS groups: - DEVELOPERS values: - 1 - 2 - name ORGANIZATION_UNITS users: - foo values: - 3
If you were using the DBP API Server Template as template for your Symfony application, then the configuration file should have already been generated for you.
For more info on bundle configuration see https://symfony.com/doc/current/bundles/configuration.html.
Development & Testing
- Install dependencies:
composer install
- Run tests:
composer test
- Run linters:
composer run lint
- Run cs-fixer:
composer run cs-fix
Bundle dependencies
Don't forget you need to pull down your dependencies in your main application if you are installing packages in a bundle.
# updates and installs dependencies of dbp/relay-core-connector-textfile-bundle
composer update dbp/relay-core-connector-textfile-bundle