/Neo4jUserBundle

Symfony 2 bundle to manage users in a Neo4j graph database

Primary LanguagePHPMIT LicenseMIT

Neo4jUserBundle

Symfony 2 bundle to manage users in a Neo4j graph database

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version

Installation

The installation is as easy as every other symfony bundle...

Add composer dep:

composer.phar require frne/neo4j-user-bundle:dev-master

Register bundle:

// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        //...
        new Frne\Bundle\Neo4jUserBundle\Neo4jUserBundle(),
        //...
        )
}

Usage

Configure the user provider in your app/config/security.yml:

# ...
encoders:
    Frne\Bundle\Neo4jUserBundle\Entity\User: sha512
# ...
providers:
    neo4j:
        id: neo4j_user_provider

Configuration

You can replace the User entity or the Dehydrator with your own implementation. See the default settings and classes to do so:

# Default configuration for extension with alias: "neo4j_user"
neo4j_user:

    # A fully qualified classname to use for user entities
    entity_classname:     Frne\Bundle\Neo4jUserBundle\Entity\User

    # A fully qualified classname to use for dehydrating users
    entity_dehydrator:    Frne\Bundle\Neo4jUserBundle\Security\User\Neo4jUserDehydrator

Creating Users

Console

Users can be created manually with the console command:

neo4j:user-bundle:create-user -u|--username="..." -p|--password="..." [-r|--roles="..."]

The username and password parameters are mandatory. If you don't assign custom roles to the created user, ROLE_USER will be assigned.

Example:

php app/console neo4j:user-bundle:create-user --username=testuser --password=1234 --roles=ROLE_FOO,ROLE_BAR

Check Neo4j server availability

There is a check, ensuring your Neo4j server is online. To use it, first install LiipMonitorBundle ("liip/monitor-bundle") as suggested from composer. Once the monitor is working, the Neo4j check will be automaticly added and executed.

Contribution

If you find any bugs or improvements, please open an issue or propose a pull request here.

The code must follow the Symfony coding standarts and conventions. Untested code will not be merged ;)