mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-08 10:34:34 +00:00

* expose cli phrasea v3 * retrocompatible with v2 * fix connection by idp * remove placeholder * some fix * some fix * fix * fix auth from IDP * list expose --------- Co-authored-by: Nicolas Maillat <maillat@alchemy.fr>
50 lines
1.6 KiB
PHP
50 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Alchemy\Phrasea\WorkerManager\Subscriber;
|
|
|
|
use Alchemy\Phrasea\WorkerManager\Event\ExposeUploadEvent;
|
|
use Alchemy\Phrasea\WorkerManager\Event\WorkerEvents;
|
|
use Alchemy\Phrasea\WorkerManager\Queue\MessagePublisher;
|
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|
|
|
class ExposeSubscriber implements EventSubscriberInterface
|
|
{
|
|
/** @var MessagePublisher $messagePublisher */
|
|
private $messagePublisher;
|
|
|
|
public function __construct(MessagePublisher $messagePublisher)
|
|
{
|
|
$this->messagePublisher = $messagePublisher;
|
|
}
|
|
|
|
public function onExposeUploadAssets(ExposeUploadEvent $event)
|
|
{
|
|
foreach (explode(";", $event->getLst()) as $bas_rec) {
|
|
$basrec = explode('_', $bas_rec);
|
|
if (count($basrec) != 2) {
|
|
continue;
|
|
}
|
|
|
|
$payload = [
|
|
'message_type' => MessagePublisher::EXPOSE_UPLOAD_TYPE,
|
|
'payload' => [
|
|
'recordId' => (int) $basrec[1],
|
|
'databoxId' => (int) $basrec[0],
|
|
'exposeName' => $event->getExposeName(),
|
|
'publicationId' => $event->getPublicationId(),
|
|
'accessTokenInfo' => $event->getAccessTokenInfo()
|
|
]
|
|
];
|
|
|
|
$this->messagePublisher->publishMessage($payload, MessagePublisher::EXPOSE_UPLOAD_TYPE);
|
|
}
|
|
}
|
|
|
|
public static function getSubscribedEvents()
|
|
{
|
|
return [
|
|
WorkerEvents::EXPOSE_UPLOAD_ASSETS => 'onExposeUploadAssets',
|
|
];
|
|
}
|
|
}
|