diff --git a/config/parameters.yaml b/config/parameters.yaml index ba63a202..1cfa41a4 100644 --- a/config/parameters.yaml +++ b/config/parameters.yaml @@ -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. diff --git a/config/services.yaml b/config/services.yaml index cba39569..26c35cba 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -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: diff --git a/docs/configuration.md b/docs/configuration.md index 39a714e7..f7748195 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -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 diff --git a/src/Controller/ToolsController.php b/src/Controller/ToolsController.php index 65321a19..a40b9440 100644 --- a/src/Controller/ToolsController.php +++ b/src/Controller/ToolsController.php @@ -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'), diff --git a/src/DataTables/Filters/Constraints/NumberConstraint.php b/src/DataTables/Filters/Constraints/NumberConstraint.php index 81ab26a6..b87a6cc4 100644 --- a/src/DataTables/Filters/Constraints/NumberConstraint.php +++ b/src/DataTables/Filters/Constraints/NumberConstraint.php @@ -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 { diff --git a/src/DataTables/Filters/Constraints/Part/ParameterValueConstraint.php b/src/DataTables/Filters/Constraints/Part/ParameterValueConstraint.php index 0b4d5271..1451713b 100644 --- a/src/DataTables/Filters/Constraints/Part/ParameterValueConstraint.php +++ b/src/DataTables/Filters/Constraints/Part/ParameterValueConstraint.php @@ -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']; diff --git a/src/EventSubscriber/LogSystem/LogLogoutEventListener.php b/src/EventListener/LogSystem/LogLogoutEventListener.php similarity index 80% rename from src/EventSubscriber/LogSystem/LogLogoutEventListener.php rename to src/EventListener/LogSystem/LogLogoutEventListener.php index 80dfb98f..eab278b4 100644 --- a/src/EventSubscriber/LogSystem/LogLogoutEventListener.php +++ b/src/EventListener/LogSystem/LogLogoutEventListener.php @@ -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 - */ - public static function getSubscribedEvents(): array - { - return ['' => '']; - } + } diff --git a/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php b/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php index 66fb9fde..28cf7b48 100644 --- a/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php +++ b/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php @@ -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) { diff --git a/src/EventSubscriber/SymfonyDebugToolbarSubscriber.php b/src/EventSubscriber/SymfonyDebugToolbarSubscriber.php index c404ffc0..6f17e399 100644 --- a/src/EventSubscriber/SymfonyDebugToolbarSubscriber.php +++ b/src/EventSubscriber/SymfonyDebugToolbarSubscriber.php @@ -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; } diff --git a/src/EventSubscriber/UserSystem/LoginSuccessSubscriber.php b/src/EventSubscriber/UserSystem/LoginSuccessSubscriber.php index e1cdfd84..d67a8e14 100644 --- a/src/EventSubscriber/UserSystem/LoginSuccessSubscriber.php +++ b/src/EventSubscriber/UserSystem/LoginSuccessSubscriber.php @@ -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); diff --git a/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php b/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php index cf1206c1..277cf62d 100644 --- a/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php +++ b/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php @@ -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) { } diff --git a/src/Form/AdminPages/CurrencyAdminForm.php b/src/Form/AdminPages/CurrencyAdminForm.php index 7ebe08bb..d6c5f590 100644 --- a/src/Form/AdminPages/CurrencyAdminForm.php +++ b/src/Form/AdminPages/CurrencyAdminForm.php @@ -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), ]); diff --git a/src/Form/AdminPages/SupplierForm.php b/src/Form/AdminPages/SupplierForm.php index d5253c1a..02efd45f 100644 --- a/src/Form/AdminPages/SupplierForm.php +++ b/src/Form/AdminPages/SupplierForm.php @@ -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), diff --git a/src/Services/UserSystem/PermissionManager.php b/src/Services/UserSystem/PermissionManager.php index 5ef71d4c..cf3e1455 100644 --- a/src/Services/UserSystem/PermissionManager.php +++ b/src/Services/UserSystem/PermissionManager.php @@ -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()) {