kronhyx/session-bundle

Get online users and set rules

v1.4.4 2017-07-25 22:55 UTC

README

SessionBundle

SensioLabsInsight

SessionBundle Toolbar View

This bundle allows you to **obtain** all **users connected** to the system. In the same way it allows to define if the **multi-session** and the **multi-user** in the same is allowed.

Latest Stable Version Total Downloads Dependency Status Symfony License travis

Installation

Step 1: Download the Bundle

$ composer require kronhyx/session-bundle

This command requires that you have global composer installed, as explained in composer's documentation.

Step 2: Activate the Bundle

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new \Kronhyx\SessionBundle\KronhyxSessionBundle()
        );
    }

    // ...
}

Step 3: Load the bundle routes

# app/config/routing.yml
kronhyx_session:
    resource: "@KronhyxSessionBundle/Resources/config/routing.yml"    
    prefix:   /
# ...

Step 4: Add the bundle configuration

# app/config/config.yml
kronhyx_session:
    user_interface: 'AppBundle:UserEntity'
    firewall: 'main'
    collector: true
    time:
        ajax: 5
        idle: 15
    allow:
        multisesion: true
        multiuser: true
# ...

Configuration:

  • user_interface (required): Represents the user provider entity that extends from UserInterface
  • firewall: (default: main) Defines the name of the FIREWALL to which the security.yml rules belong
  • collector: (default: true) Defines whether to show the collector in the debug bar in _profiler
  • time.ajax: (default: 5)Time in seconds it takes to perform the next query that returns active sessions
  • time.idle: (default: 15)Time in seconds to define if a user is disconnected from the system
  • allow.multiuser: (default: true) Defines whether a user is allowed to have multiple active sessions on the same IP
  • allow.multisesion: (default: true) Defines whether a user is allowed to log in multiple times at the same time

Step 5: Add a handler in the security.yml

# app/config/security.yml
# ...
firewalls:
    # ...
    form_login:
        # ...
        logout:
            handlers: [ Kronhyx\SessionBundle\Event\Listener\KernelListener ]
        # ...
    # ...

Step 6: Update Entities

$ php bin/console doctrine:schema:update --force 

Documentation

You can read all the documentation and functionalities of this bundle to make better use of this.

Contributing

SessionBundle is a bundle for symfony framework, as it has been developed this has contributed a series of users that list here.

Security Issues

If you discover a vulnerability, a bug or have some idea to improve to propose that it leads to a better performance of this bundle, please contact us or leave your concerns here

Copyright

Copyright (c) 2017. See LICENSE for details.