mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-27 04:08:57 +02:00
Removed deprecated SessionInterface service
This commit is contained in:
parent
1cee1abe00
commit
b3ecee749e
4 changed files with 21 additions and 17 deletions
|
@ -40,16 +40,14 @@ class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface
|
|||
private Security $security;
|
||||
private PermissionSchemaUpdater $permissionSchemaUpdater;
|
||||
private EntityManagerInterface $entityManager;
|
||||
private FlashBagInterface $flashBag;
|
||||
private EventCommentHelper $eventCommentHelper;
|
||||
|
||||
public function __construct(Security $security, PermissionSchemaUpdater $permissionSchemaUpdater, EntityManagerInterface $entityManager, SessionInterface $session, EventCommentHelper $eventCommentHelper)
|
||||
public function __construct(Security $security, PermissionSchemaUpdater $permissionSchemaUpdater, EntityManagerInterface $entityManager, EventCommentHelper $eventCommentHelper)
|
||||
{
|
||||
/** @var Session $session */
|
||||
$this->security = $security;
|
||||
$this->permissionSchemaUpdater = $permissionSchemaUpdater;
|
||||
$this->entityManager = $entityManager;
|
||||
$this->flashBag = $session->getFlashBag();
|
||||
$this->eventCommentHelper = $eventCommentHelper;
|
||||
}
|
||||
|
||||
|
@ -65,11 +63,15 @@ class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface
|
|||
$user = $this->entityManager->getRepository(User::class)->getAnonymousUser();
|
||||
}
|
||||
|
||||
/** @var Session $session */
|
||||
$session = $event->getRequest()->getSession();
|
||||
$flashBag = $session->getFlashBag();
|
||||
|
||||
if ($this->permissionSchemaUpdater->isSchemaUpdateNeeded($user)) {
|
||||
$this->eventCommentHelper->setMessage('Automatic permission schema update');
|
||||
$this->permissionSchemaUpdater->userUpgradeSchemaRecursively($user);
|
||||
$this->entityManager->flush();
|
||||
$this->flashBag->add('notice', 'user.permissions_schema_updated');
|
||||
$flashBag->add('notice', 'user.permissions_schema_updated');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue