Download the PHP package linkorb/userbase-role-provider-bundle without Composer
On this page you can find all versions of the php package linkorb/userbase-role-provider-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download linkorb/userbase-role-provider-bundle
More information about linkorb/userbase-role-provider-bundle
Files in linkorb/userbase-role-provider-bundle
Package userbase-role-provider-bundle
Short Description Userbase Role Provider Bundle for modern Symfony Applications
License MIT
Informations about the package userbase-role-provider-bundle
Userbase Role Provider Bundle
Use this bundle to add Roles to Users loaded by the UserProvider.
Userbase does not provide Role information about its users so apps need to supply their own. This bundle allows you to define fixed roles for your users and these will be incorporated into the User objects loaded by the Userbase UserProvider.
Define the fixed roles in a Yaml file at config/roles.yaml
:-
Next, clear the app cache so that the roles are baked into the service container configuration. And that's it! You can now restrict access to resources based on these roles.
The bundle will load roles from the roles.yaml file without any further
configuration. It can instead be made to load roles from the environment.
Populating a service parameter named userbase.roles
is the key to this
alternative configuration:
The change to userbase.yaml will require that the app cache is cleared. Then
the roles will be loaded from the USERBASE_ROLES
environment variable at the
start of every request.
Installation
Note: this feature requires version 1.7 or later of the userbase/client package. You may need to begin installation by issuing:-
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
Applications that don't use Symfony Flex
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the config/bundles.php
file of your project:
All versions of userbase-role-provider-bundle with dependencies
linkorb/userbase-role-contracts Version ^2.0
symfony/config Version ^6.0
symfony/dependency-injection Version ^6.0
symfony/http-kernel Version ^6.0
symfony/yaml Version ^6.0