mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 22:43:19 +00:00
Add authorization strategy for WAMP topics
This commit is contained in:
32
lib/Alchemy/Phrasea/Websocket/Consumer/ConsumerManager.php
Normal file
32
lib/Alchemy/Phrasea/Websocket/Consumer/ConsumerManager.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Websocket\Consumer;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
|
||||
class ConsumerManager
|
||||
{
|
||||
/**
|
||||
* Creates a consumer given a Session
|
||||
*
|
||||
* @param Session $session
|
||||
*
|
||||
* @return Consumer
|
||||
*/
|
||||
public function create(SessionInterface $session)
|
||||
{
|
||||
$usrId = $session->has('usr_id') ? $session->get('usr_id') : null;
|
||||
$rights = $session->has('websockets_rights') ? $session->get('websockets_rights') : [];
|
||||
|
||||
return new Consumer($usrId, $rights);;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user