recranet / user-bundle
This package is abandoned and no longer maintained.
No replacement package was suggested.
User management for Symfony2. Compatible with Doctrine ORM
1.1
2016-10-04 11:56 UTC
Requires
- php: >=5.3.2
- symfony/framework-bundle: ^2.7|^3.0
Suggests
- recranet/mandrill-swiftmailer-bundle: Improve your e-mail delivery with Mandrill
This package is auto-updated.
Last update: 2018-07-21 14:57:22 UTC
README
User management for Symfony2 and Doctrine
Installation
Install package with composer
"recranet/user-bundle": "^1.0"
Register bundles in AppKernel
new Recranet\UserBundle\RecranetUserBundle(),
Extend the User Entity from the bundle
<?php
namespace Acme\DemoBundle\Entity;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Recranet\UserBundle\Entity\User as BaseUser;
/**
* @ORM\Table(name="users")
* @ORM\Entity()
*/
class User extends BaseUser
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
}
Update config.yml
# Recranet User Bundle
recranet_user:
user_class: Acme\DemoBundle\Entity\User
firewall_name: main
mailer:
from_email: info@recranet.com
from_name: Recranet
registration: # Optional
approval: false
enabled: true
Update security.yml
security:
encoders:
Acme\DemoBundle\Entity\User:
algorithm: bcrypt
cost: 16
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
doctrine:
id: recranet_user.user_provider
firewalls:
main:
pattern: ^/
anonymous: ~
context: application
form_login:
login_path: login
check_path: login_check
logout:
path: logout
target: /
access_control:
- { path: ^/%locale%/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/%locale%/password/reset, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/%locale%/password/request, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/%locale%/password/change, role: IS_AUTHENTICATED_FULLY }
Update routing.yml
recranet_user:
resource: "@RecranetUserBundle/Resources/config/routing.yml"
prefix: /