From b2f751644a1570608bd22465b35888c5027f5d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 7 Mar 2020 22:26:47 +0100 Subject: [PATCH] Give user creation/deletions a NOTICE level. --- src/Entity/LogSystem/ElementCreatedLogEntry.php | 7 +++++++ src/Entity/LogSystem/ElementDeletedLogEntry.php | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/Entity/LogSystem/ElementCreatedLogEntry.php b/src/Entity/LogSystem/ElementCreatedLogEntry.php index e49e4d0d..cc591db3 100644 --- a/src/Entity/LogSystem/ElementCreatedLogEntry.php +++ b/src/Entity/LogSystem/ElementCreatedLogEntry.php @@ -45,6 +45,8 @@ namespace App\Entity\LogSystem; use App\Entity\Base\AbstractDBElement; use App\Entity\Contracts\LogWithCommentInterface; use App\Entity\Contracts\LogWithEventUndoInterface; +use App\Entity\UserSystem\Group; +use App\Entity\UserSystem\User; use Doctrine\ORM\Mapping as ORM; /** @@ -59,6 +61,11 @@ class ElementCreatedLogEntry extends AbstractLogEntry implements LogWithCommentI parent::__construct(); $this->level = self::LEVEL_INFO; $this->setTargetElement($new_element); + + //Creation of new users is maybe more interesting... + if ($new_element instanceof User || $new_element instanceof Group) { + $this->level = self::LEVEL_NOTICE; + } } /** diff --git a/src/Entity/LogSystem/ElementDeletedLogEntry.php b/src/Entity/LogSystem/ElementDeletedLogEntry.php index cfcb6844..c6e6c4f3 100644 --- a/src/Entity/LogSystem/ElementDeletedLogEntry.php +++ b/src/Entity/LogSystem/ElementDeletedLogEntry.php @@ -47,6 +47,8 @@ use App\Entity\Contracts\LogWithCommentInterface; use App\Entity\Contracts\LogWithEventUndoInterface; use App\Entity\Contracts\NamedElementInterface; use App\Entity\Contracts\TimeTravelInterface; +use App\Entity\UserSystem\Group; +use App\Entity\UserSystem\User; use Doctrine\ORM\Mapping as ORM; /** @@ -61,6 +63,11 @@ class ElementDeletedLogEntry extends AbstractLogEntry implements TimeTravelInter parent::__construct(); $this->level = self::LEVEL_INFO; $this->setTargetElement($deleted_element); + + //Deletion of a user is maybe more interesting... + if ($deleted_element instanceof User || $deleted_element instanceof Group) { + $this->level = self::LEVEL_NOTICE; + } } /**