Download the PHP package soft-passio/user-bundle without Composer
On this page you can find all versions of the php package soft-passio/user-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package user-bundle
SoftPassio UserBundle documentation v2.0
Simple and lightweight User bundle for Symfony 3 projects. Provides user and role functionalities with ACL support.
Old version:
If u need help with 1.* branch, visit v1.x documentation.
Installation:
Required the bundle with composer:
~~~~ {.sourceCode .} $ php composer.phar require soft-passio/user-bundle
Configuration
-------------
Register the bundle in your AppKernel.php
~~~~ {.sourceCode .php}
// ./app/AppKernel.php
public function registerBundles()
{
$bundles = [
...
new SoftPassio\UserBundle\UserBundle(),
...
];
}
Add a new config file, for example user.yml
~~~~ {.sourceCode .yaml}
./app/config/user.yml
user: entities: user_class: #E.g. AppBundle\Entity\User
acl:
enabled: #true|false defines to use or not to use ACL
access_denied_path: #route bame where user should be redirect when he dont have privileges to action
Import user.yml file to config.yml
~~~~ {.sourceCode .yaml}
imports:
...
- { resource: user.yml }
Next create two entities in your bundle (E.g. AppBundle\Entity):
- User
~~~~ {.sourceCode .php}
*You can use configuration format which you prefer (yml, xml, php or
annotation)*
Run
php bin/console doctrine:schema:update --force
Now You can create admin user with command line:
php bin/console user:create:admin <username> <email> <password>
ACL
---
Enable ACL
~~~~ {.sourceCode .yaml}
#./app/config/user.yml
user:
acl
enabled: true
access_denied_path: #route name
Use annotation to define protected action
Custom AccessResolver
In some cases u need to create your own logic to decide about access to action. In that case u just need to create custom accessResolver and put your logic
Insert new resolver to configuration file: ~~~~ {.sourceCode .yaml}
./app/config/user.yml
user: entities: user_class: #E.g. AppBundle\Entity\User
acl:
enabled: #true|false defines to use or not to use ACL
access_denied_path: #route bame where user should be redirect when he dont have privileges to action
access_resolver_class: AppBundle\Security\CustomAccessResolver
All versions of user-bundle with dependencies
stof/doctrine-extensions-bundle Version ^1.2
php Version ^7.2
doctrine/orm Version *
symfony/flex Version ^1.1
sensio/framework-extra-bundle Version ^5.1
symfony/framework-bundle Version ^4.4
soft-passio/components Version ^2.0
jms/serializer-bundle Version ^2.0 || ^3.3