mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Fixed service wiring configuration
This commit is contained in:
parent
98dc553938
commit
f63b6d7207
14 changed files with 29 additions and 35 deletions
|
@ -19,7 +19,7 @@ parameters:
|
|||
######################################################################################################################
|
||||
# Users and Privacy
|
||||
######################################################################################################################
|
||||
partdb.gpdr_compliance: true # If this option is activated, IP addresses are anonymized to be GPDR compliant
|
||||
partdb.gdpr_compliance: true # If this option is activated, IP addresses are anonymized to be GDPR compliant
|
||||
partdb.users.use_gravatar: '%env(bool:USE_GRAVATAR)%' # Set to false, if no Gravatar images should be used for user profiles.
|
||||
partdb.users.email_pw_reset: '%env(bool:ALLOW_EMAIL_PW_RESET)%' # Config if users are able, to reset their password by email. By default this enabled, when a mail server is configured.
|
||||
|
||||
|
|
|
@ -14,11 +14,11 @@ services:
|
|||
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
|
||||
bind:
|
||||
bool $demo_mode: '%partdb.demo_mode%'
|
||||
bool $gpdr_compliance : '%partdb.gpdr_compliance%'
|
||||
bool $kernel_debug: '%kernel.debug%'
|
||||
bool $gdpr_compliance: '%partdb.gdpr_compliance%'
|
||||
bool $kernel_debug_enabled: '%kernel.debug%'
|
||||
string $kernel_cache_dir: '%kernel.cache_dir%'
|
||||
string $partdb_title: '%partdb.title%'
|
||||
string $default_currency: '%partdb.default_currency%'
|
||||
string $base_currency: '%partdb.default_currency%'
|
||||
|
||||
_instanceof:
|
||||
App\Services\LabelSystem\PlaceholderProviders\PlaceholderProviderInterface:
|
||||
|
@ -88,7 +88,7 @@ services:
|
|||
|
||||
App\Form\AttachmentFormType:
|
||||
arguments:
|
||||
$allow_attachments_downloads: '%partdb.attachments.allow_downloads%'
|
||||
$allow_attachments_download: '%partdb.attachments.allow_downloads%'
|
||||
$max_file_size: '%partdb.attachments.max_file_size%'
|
||||
|
||||
App\Services\Attachments\AttachmentSubmitHandler:
|
||||
|
@ -177,7 +177,7 @@ services:
|
|||
|
||||
App\EventSubscriber\UserSystem\SetUserTimezoneSubscriber:
|
||||
arguments:
|
||||
$timezone: '%partdb.timezone%'
|
||||
$default_timezone: '%partdb.timezone%'
|
||||
|
||||
App\Controller\SecurityController:
|
||||
arguments:
|
||||
|
|
|
@ -98,7 +98,7 @@ The following options are available:
|
|||
|
||||
* `partdb.global_theme`: The default theme to use, when no user specific theme is set. Should be one of the themes from the `partdb.available_themes` config option.
|
||||
* `partdb.locale_menu`: The codes of the languages, which should be shown in the language chooser menu (the one with the user icon in the navbar). The first language in the list will be the default language.
|
||||
* `partdb.gpdr_compliance`: When set to true (default value), IP addresses which are saved in the database will be anonymized, by removing the last byte of the IP. This is required by the GDPR (General Data Protection Regulation) in the EU.
|
||||
* `partdb.gdpr_compliance`: When set to true (default value), IP addresses which are saved in the database will be anonymized, by removing the last byte of the IP. This is required by the GDPR (General Data Protection Regulation) in the EU.
|
||||
* `partdb.sidebar.items`: The panel contents which should be shown in the sidebar by default. You can also change the number of sidebar panels by changing the number of items in this list.
|
||||
* `partdb.sidebar.root_node_enable`: Show a root node in the sidebar trees, of which all nodes are children of
|
||||
* `partdb.sidebar.root_expanded`: Expand the root node in the sidebar trees by default
|
||||
|
|
|
@ -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