mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-02 22:44:33 +02:00
Fixed service wiring configuration
This commit is contained in:
parent
98dc553938
commit
f63b6d7207
14 changed files with 29 additions and 35 deletions
|
@ -59,7 +59,7 @@ class ToolsController extends AbstractController
|
|||
'default_theme' => $this->getParameter('partdb.global_theme'),
|
||||
'enabled_locales' => $this->getParameter('partdb.locale_menu'),
|
||||
'demo_mode' => $this->getParameter('partdb.demo_mode'),
|
||||
'gpdr_compliance' => $this->getParameter('partdb.gpdr_compliance'),
|
||||
'gpdr_compliance' => $this->getParameter('partdb.gdpr_compliance'),
|
||||
'use_gravatar' => $this->getParameter('partdb.users.use_gravatar'),
|
||||
'email_password_reset' => $this->getParameter('partdb.users.email_pw_reset'),
|
||||
'enviroment' => $this->getParameter('kernel.environment'),
|
||||
|
|
|
@ -25,7 +25,7 @@ use RuntimeException;
|
|||
|
||||
class NumberConstraint extends AbstractConstraint
|
||||
{
|
||||
final public const ALLOWED_OPERATOR_VALUES = ['=', '!=', '<', '>', '<=', '>=', 'BETWEEN'];
|
||||
protected const ALLOWED_OPERATOR_VALUES = ['=', '!=', '<', '>', '<=', '>=', 'BETWEEN'];
|
||||
|
||||
public function getValue1(): float|int|null|\DateTimeInterface
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ use Doctrine\ORM\QueryBuilder;
|
|||
|
||||
class ParameterValueConstraint extends NumberConstraint
|
||||
{
|
||||
final public const ALLOWED_OPERATOR_VALUES = ['=', '!=', '<', '>', '<=', '>=', 'BETWEEN',
|
||||
protected const ALLOWED_OPERATOR_VALUES = ['=', '!=', '<', '>', '<=', '>=', 'BETWEEN',
|
||||
//Additional operators
|
||||
'IN_RANGE', 'NOT_IN_RANGE', 'GREATER_THAN_RANGE', 'GREATER_EQUAL_RANGE', 'LESS_THAN_RANGE', 'LESS_EQUAL_RANGE', 'RANGE_IN_RANGE', 'RANGE_INTERSECT_RANGE'];
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\EventSubscriber\LogSystem;
|
||||
namespace App\EventListener\LogSystem;
|
||||
|
||||
use App\Entity\LogSystem\UserLogoutLogEntry;
|
||||
use App\Entity\UserSystem\User;
|
||||
|
@ -32,9 +32,9 @@ use Symfony\Component\Security\Http\Event\LogoutEvent;
|
|||
* This handler logs to event log, if a user logs out.
|
||||
*/
|
||||
#[AsEventListener]
|
||||
final class LogLogoutEventEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
|
||||
final class LogLogoutEventListener
|
||||
{
|
||||
public function __construct(protected EventLogger $logger, protected bool $gpdr_compliance)
|
||||
public function __construct(private EventLogger $logger, private readonly bool $gdpr_compliance)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ final class LogLogoutEventEventSubscriber implements \Symfony\Component\EventDis
|
|||
return;
|
||||
}
|
||||
|
||||
$log = new UserLogoutLogEntry($request->getClientIp(), $this->gpdr_compliance);
|
||||
$log = new UserLogoutLogEntry($request->getClientIp(), $this->gdpr_compliance);
|
||||
$user = $token->getUser();
|
||||
if ($user instanceof User) {
|
||||
$log->setTargetElement($user);
|
||||
|
@ -55,11 +55,5 @@ final class LogLogoutEventEventSubscriber implements \Symfony\Component\EventDis
|
|||
|
||||
$this->logger->logAndFlush($log);
|
||||
}
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return ['' => ''];
|
||||
}
|
||||
|
||||
}
|
|
@ -53,7 +53,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
|
|||
*/
|
||||
final class SecurityEventLoggerSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
public function __construct(private readonly RequestStack $requestStack, private readonly EventLogger $eventLogger, private readonly bool $gpdr_compliant)
|
||||
public function __construct(private readonly RequestStack $requestStack, private readonly EventLogger $eventLogger, private readonly bool $gdpr_compliance)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ final class SecurityEventLoggerSubscriber implements EventSubscriberInterface
|
|||
|
||||
private function addLog(string $type, SecurityEvent $event): void
|
||||
{
|
||||
$anonymize = $this->gpdr_compliant;
|
||||
$anonymize = $this->gdpr_compliance;
|
||||
|
||||
$request = $this->requestStack->getCurrentRequest();
|
||||
if ($request instanceof \Symfony\Component\HttpFoundation\Request) {
|
||||
|
|
|
@ -30,7 +30,7 @@ use Symfony\Component\HttpKernel\Event\ResponseEvent;
|
|||
*/
|
||||
final class SymfonyDebugToolbarSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
public function __construct(private readonly bool $kernel_debug)
|
||||
public function __construct(private readonly bool $kernel_debug_enabled)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ final class SymfonyDebugToolbarSubscriber implements EventSubscriberInterface
|
|||
|
||||
public function onKernelResponse(ResponseEvent $event): void
|
||||
{
|
||||
if (!$this->kernel_debug) {
|
||||
if (!$this->kernel_debug_enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,14 +37,14 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||
*/
|
||||
final class LoginSuccessSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
public function __construct(private readonly TranslatorInterface $translator, private readonly RequestStack $requestStack, private readonly EventLogger $eventLogger, private readonly bool $gpdr_compliance)
|
||||
public function __construct(private readonly TranslatorInterface $translator, private readonly RequestStack $requestStack, private readonly EventLogger $eventLogger, private readonly bool $gdpr_compliance)
|
||||
{
|
||||
}
|
||||
|
||||
public function onLogin(InteractiveLoginEvent $event): void
|
||||
{
|
||||
$ip = $event->getRequest()->getClientIp();
|
||||
$log = new UserLoginLogEntry($ip, $this->gpdr_compliance);
|
||||
$log = new UserLoginLogEntry($ip, $this->gdpr_compliance);
|
||||
$user = $event->getAuthenticationToken()->getUser();
|
||||
if ($user instanceof User && $user->getID()) {
|
||||
$log->setTargetElement($user);
|
||||
|
|
|
@ -23,17 +23,17 @@ declare(strict_types=1);
|
|||
namespace App\EventSubscriber\UserSystem;
|
||||
|
||||
use App\Entity\UserSystem\User;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpKernel\Event\ControllerEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
/**
|
||||
* The purpose of this event listener is to set the timezone to the one preferred by the user.
|
||||
*/
|
||||
final class SetUserTimezoneSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
public function __construct(private readonly string $default_timezone, private readonly \Symfony\Bundle\SecurityBundle\Security $security)
|
||||
public function __construct(private readonly string $default_timezone, private readonly Security $security)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ use Symfony\Component\Security\Core\Security;
|
|||
|
||||
class CurrencyAdminForm extends BaseEntityAdminForm
|
||||
{
|
||||
public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, private readonly string $default_currency)
|
||||
public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, private readonly string $base_currency)
|
||||
{
|
||||
parent::__construct($security, $eventCommentNeededHelper);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class CurrencyAdminForm extends BaseEntityAdminForm
|
|||
$builder->add('exchange_rate', BigDecimalMoneyType::class, [
|
||||
'required' => false,
|
||||
'label' => 'currency.edit.exchange_rate',
|
||||
'currency' => $this->default_currency,
|
||||
'currency' => $this->base_currency,
|
||||
'scale' => 6,
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
|
|
@ -32,7 +32,7 @@ use Symfony\Component\Security\Core\Security;
|
|||
|
||||
class SupplierForm extends CompanyForm
|
||||
{
|
||||
public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, protected string $default_currency)
|
||||
public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, protected string $base_currency)
|
||||
{
|
||||
parent::__construct($security, $eventCommentNeededHelper);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class SupplierForm extends CompanyForm
|
|||
|
||||
$builder->add('shipping_costs', BigDecimalMoneyType::class, [
|
||||
'required' => false,
|
||||
'currency' => $this->default_currency,
|
||||
'currency' => $this->base_currency,
|
||||
'scale' => 3,
|
||||
'label' => 'supplier.shipping_costs.label',
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
|
|
|
@ -45,7 +45,7 @@ class PermissionManager
|
|||
/**
|
||||
* PermissionResolver constructor.
|
||||
*/
|
||||
public function __construct(protected bool $is_debug, string $kernel_cache_dir)
|
||||
public function __construct(protected readonly bool $kernel_debug_enabled, string $kernel_cache_dir)
|
||||
{
|
||||
$cache_dir = $kernel_cache_dir;
|
||||
//Here the cached structure will be saved.
|
||||
|
@ -271,7 +271,7 @@ class PermissionManager
|
|||
|
||||
protected function generatePermissionStructure()
|
||||
{
|
||||
$cache = new ConfigCache($this->cache_file, $this->is_debug);
|
||||
$cache = new ConfigCache($this->cache_file, $this->kernel_debug_enabled);
|
||||
|
||||
//Check if the cache is fresh, else regenerate it.
|
||||
if (!$cache->isFresh()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue