nedwave/user-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

User management for Symfony2. Compatible with Doctrine ORM

Installs: 437

Dependents: 0

Stars: 10

Watchers: 3

Forks: 4

Open Issues: 0

Type: symfony-bundle

This package has no released version yet, and little information is available.


README

User management for Symfony2 and Doctrine

Installation

Install package with composer

"nedwave/user-bundle": "^3.0"

Register bundles in AppKernel

new Nedwave\UserBundle\NedwaveUserBundle(),

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 Nedwave\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

# Nedwave User Bundle
nedwave_user:
    user_class: Acme\DemoBundle\Entity\User
    firewall_name: main
    mailer:
        from_email: info@nedwave.com
        from_name: Nedwave
    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: nedwave_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

nedwave_user:
    resource: "@NedwaveUserBundle/Resources/config/routing.yml"
    prefix:   /