4 You may buy me a Beer, a Tea or help with Server fees with a paypal donation to
5 the address <paypal@rapsys.eu>.
7 Don't forget to show your love for this project, feel free to report bugs to
8 the author, issues which are security relevant should be disclosed privately
11 Patches are welcomed and grant credit when requested.
16 Applications that use Symfony Flex
17 ----------------------------------
19 Add bundle custom repository to your project's `composer.json` file:
28 "name": "rapsys/userbundle",
29 "version": "dev-master",
32 "url": "https://git.rapsys.eu/userbundle",
37 "Rapsys\\UserBundle\\": ""
41 "doctrine/doctrine-bundle": "^1.0|^2.0",
42 "rapsys/packbundle": "dev-master",
43 "symfony/flex": "^1.0",
44 "symfony/form": "^4.0|^5.0",
45 "symfony/framework-bundle": "^4.0|^5.0",
46 "symfony/security-bundle": "^4.0|^5.0",
47 "symfony/validator": "^4.0|^5.0"
56 Then open a command console, enter your project directory and execute:
59 $ composer require rapsys/userbundle dev-master
62 Applications that don't use Symfony Flex
63 ----------------------------------------
65 ### Step 1: Download the Bundle
67 Open a command console, enter your project directory and execute the
68 following command to download the latest stable version of this bundle:
71 $ composer require rapsys/userbundle dev-master
74 This command requires you to have Composer installed globally, as explained
75 in the [installation chapter](https://getcomposer.org/doc/00-intro.md)
76 of the Composer documentation.
78 ### Step 2: Enable the Bundle
80 Then, enable the bundle by adding it to the list of registered bundles
81 in the `app/AppKernel.php` file of your project:
88 class AppKernel extends Kernel
90 public function registerBundles()
94 new Rapsys\UserBundle\RapsysUserBundle(),
104 ### Step 3: Configure the Bundle
106 Setup configuration file `config/packages/rapsysuser.yaml` with the following
107 content available in `Rapsys/UserBundle/Resources/config/packages/rapsysuser.yaml`:
110 #Doctrine configuration
114 #Force resolution of UserBundle entities to CustomBundle one
115 #XXX: without these lines, relations are lookup in parent namespace ignoring CustomBundle extension
116 resolve_target_entities:
117 Rapsys\UserBundle\Entity\Group: 'CustomBundle\Entity\Group'
118 Rapsys\UserBundle\Entity\Civility: 'CustomBundle\Entity\Civility'
119 Rapsys\UserBundle\Entity\User: 'CustomBundle\Entity\User'
121 #RapsysUser configuration
125 group: 'CustomBundle\Entity\Group'
126 civility: 'CustomBundle\Entity\Civility'
127 user: 'CustomBundle\Entity\User'
137 #Service configuration
139 #Register security context service
140 rapsysuser.access_decision_manager:
141 class: 'Symfony\Component\Security\Core\Authorization\AccessDecisionManager'
143 arguments: [ [ '@security.access.role_hierarchy_voter' ] ]
144 #Register default controller
145 Rapsys\UserBundle\Controller\DefaultController:
146 arguments: [ '@service_container', '@router', '@translator' ]
148 tags: [ 'controller.service_arguments' ]
149 #Register Authentication success handler
150 security.authentication.success_handler:
151 class: 'Rapsys\UserBundle\Handler\AuthenticationSuccessHandler'
152 arguments: [ '@router', {} ]
153 #Register Authentication failure handler
154 security.authentication.failure_handler:
155 class: 'Rapsys\UserBundle\Handler\AuthenticationFailureHandler'
156 arguments: [ '@http_kernel', '@security.http_utils', {}, '@logger', '@service_container', '@router', '@rapsys_pack.slugger_util']
157 #Register logout success handler
158 security.logout.success_handler:
159 class: 'Rapsys\UserBundle\Handler\LogoutSuccessHandler'
160 arguments: [ '@service_container', '/', '@router' ]
161 #Register security user checker
162 security.user_checker:
163 class: 'Rapsys\UserBundle\Checker\UserChecker'
166 Open a command console, enter your project directory and execute the following
167 command to see default bundle configuration:
170 $ php bin/console config:dump-reference RapsysUserBundle
173 Open a command console, enter your project directory and execute the following
174 command to see current bundle configuration:
177 $ php bin/console debug:config RapsysUserBundle
180 ### Step 4: Setup custom bundle entities
182 Setup configuration file `CustomBundle/Resources/config/doctrine/User.orm.yml` with the
186 CustomBundle\Entity\User:
188 #repositoryClass: CustomBundle\Repository\UserRepository
202 Setup configuration file `Resources/config/doctrine/Group.orm.yml` with the
206 CustomBundle\Entity\Group:
208 #repositoryClass: CustomBundle\Repository\GroupRepository
212 targetEntity: Rapsys\AirBundle\Entity\User
216 Setup configuration file `Resources/config/doctrine/Civility.orm.yml` with the
220 CustomBundle\Entity\Civility:
222 #repositoryClass: CustomBundle\Repository\CivilityRepository
230 Setup entity file `CustomBundle/Entity/User.php` with the following content:
235 namespace CustomBundle\Entity;
237 use Rapsys\UserBundle\Entity\User as BaseUser;
239 class User extends BaseUser {}
242 Setup entity file `CustomBundle/Entity/Group.php` with the following content:
247 namespace CustomBundle\Entity;
249 use Rapsys\GroupBundle\Entity\Group as BaseGroup;
251 class Group extends BaseGroup {}
254 Setup entity file `CustomBundle/Entity/Civility.php` with the following content:
259 namespace CustomBundle\Entity;
261 use Rapsys\CivilityBundle\Entity\Civility as BaseCivility;
263 class Civility extends BaseCivility {}