Give user creation/deletions a NOTICE level.

This commit is contained in:
Jan Böhmer 2020-03-07 22:26:47 +01:00
parent 70abc47ae0
commit b2f751644a
2 changed files with 14 additions and 0 deletions

View file

@ -45,6 +45,8 @@ namespace App\Entity\LogSystem;
use App\Entity\Base\AbstractDBElement; use App\Entity\Base\AbstractDBElement;
use App\Entity\Contracts\LogWithCommentInterface; use App\Entity\Contracts\LogWithCommentInterface;
use App\Entity\Contracts\LogWithEventUndoInterface; use App\Entity\Contracts\LogWithEventUndoInterface;
use App\Entity\UserSystem\Group;
use App\Entity\UserSystem\User;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
@ -59,6 +61,11 @@ class ElementCreatedLogEntry extends AbstractLogEntry implements LogWithCommentI
parent::__construct(); parent::__construct();
$this->level = self::LEVEL_INFO; $this->level = self::LEVEL_INFO;
$this->setTargetElement($new_element); $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;
}
} }
/** /**

View file

@ -47,6 +47,8 @@ use App\Entity\Contracts\LogWithCommentInterface;
use App\Entity\Contracts\LogWithEventUndoInterface; use App\Entity\Contracts\LogWithEventUndoInterface;
use App\Entity\Contracts\NamedElementInterface; use App\Entity\Contracts\NamedElementInterface;
use App\Entity\Contracts\TimeTravelInterface; use App\Entity\Contracts\TimeTravelInterface;
use App\Entity\UserSystem\Group;
use App\Entity\UserSystem\User;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
@ -61,6 +63,11 @@ class ElementDeletedLogEntry extends AbstractLogEntry implements TimeTravelInter
parent::__construct(); parent::__construct();
$this->level = self::LEVEL_INFO; $this->level = self::LEVEL_INFO;
$this->setTargetElement($deleted_element); $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;
}
} }
/** /**