-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
375 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<?php | ||
|
||
namespace Claroline\LogBundle\Entity\Archive; | ||
|
||
use Claroline\LogBundle\Entity\AbstractLog; | ||
use Claroline\LogBundle\Entity\FunctionalLog; | ||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
/** | ||
* @ORM\Entity | ||
* @ORM\Table(null) | ||
*/ | ||
class FunctionalLogArchive extends AbstractLog | ||
{ | ||
/** | ||
* @var string|null | ||
* @ORM\Column(type="int", nullable=true) | ||
*/ | ||
private $userId; | ||
|
||
/** | ||
* @var string|null | ||
* @ORM\Column(type="string", nullable=true) | ||
*/ | ||
private $userUuid; | ||
|
||
/** | ||
* @var string|null | ||
* @ORM\Column(type="string", nullable=true) | ||
*/ | ||
private $userUsername; | ||
|
||
/** | ||
* @var string|null | ||
* @ORM\Column(type="string", nullable=true) | ||
*/ | ||
private $workspaceUuid; | ||
|
||
/** | ||
* @var string|null | ||
* @ORM\Column(type="string", nullable=true) | ||
*/ | ||
private $resourceUuid; | ||
|
||
public static function fromFunctionalLog(FunctionalLog $functionalLog) | ||
{ | ||
$user = $functionalLog->getUser(); | ||
$workspace = $functionalLog->getWorkspace(); | ||
$resource = $functionalLog->getResource(); | ||
|
||
$archive = new self(); | ||
$archive->setUserId($user->getId()); | ||
$archive->setUserUuid($user->getUuid()); | ||
$archive->setUserUsername($user->getUsername()); | ||
$archive->setResourceUuid($resource ? $resource->getUuid() : null); | ||
$archive->setWorkspaceUuid($workspace ? $workspace->getUuid() : null); | ||
|
||
$archive->setDate($functionalLog->getDate()); | ||
$archive->setDetails($functionalLog->getDetails()); | ||
$archive->setEvent($functionalLog->getEvent()); | ||
|
||
return $archive; | ||
} | ||
|
||
public function getUserId(): ?int | ||
{ | ||
return $this->userId; | ||
} | ||
|
||
public function setUserId(?int $userId): void | ||
{ | ||
$this->userId = $userId; | ||
} | ||
|
||
public function getUserUuid(): ?string | ||
{ | ||
return $this->userUuid; | ||
} | ||
|
||
public function setUserUuid(?string $userUuid): void | ||
{ | ||
$this->userUuid = $userUuid; | ||
} | ||
|
||
public function getUserUsername(): ?string | ||
{ | ||
return $this->userUsername; | ||
} | ||
|
||
public function setUserUsername(?string $userUsername): void | ||
{ | ||
$this->userUsername = $userUsername; | ||
} | ||
|
||
public function getWorkspaceUuid(): ?string | ||
{ | ||
return $this->workspaceUuid; | ||
} | ||
|
||
public function setWorkspaceUuid(?string $workspaceUuid): void | ||
{ | ||
$this->workspaceUuid = $workspaceUuid; | ||
} | ||
|
||
public function getResourceUuid(): ?string | ||
{ | ||
return $this->resourceUuid; | ||
} | ||
|
||
public function setResourceUuid(?string $resourceUuid): void | ||
{ | ||
$this->resourceUuid = $resourceUuid; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
<?php | ||
|
||
namespace Claroline\LogBundle\Entity\Archive; | ||
|
||
use Claroline\LogBundle\Entity\AbstractLog; | ||
use Claroline\LogBundle\Entity\MessageLog; | ||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
/** | ||
* @ORM\Entity | ||
* @ORM\Table(null) | ||
*/ | ||
class MessageLogArchive extends AbstractLog | ||
{ | ||
/** | ||
* @var int|null | ||
* @ORM\Column(type="integer", nullable=true) | ||
*/ | ||
private $senderId; | ||
|
||
/** | ||
* @var string|null | ||
* @ORM\Column(type="string", nullable=true) | ||
*/ | ||
private $senderUuid; | ||
|
||
/** | ||
* @var string|null | ||
* @ORM\Column(type="string", nullable=true) | ||
*/ | ||
private $senderUsername; | ||
|
||
/** | ||
* @var int|null | ||
* @ORM\Column(type="integer", nullable=true) | ||
*/ | ||
private $receiverId; | ||
|
||
/** | ||
* @var string|null | ||
* @ORM\Column(type="string", nullable=true) | ||
*/ | ||
private $receiverUuid; | ||
|
||
/** | ||
* @var string|null | ||
* @ORM\Column(type="string") | ||
*/ | ||
private $receiverUsername; | ||
|
||
public static function fromMessageLog(MessageLog $messageLog) | ||
{ | ||
$sender = $messageLog->getSender(); | ||
$receiver = $messageLog->getReceiver(); | ||
|
||
$archive = new self(); | ||
$archive->setDate($messageLog->getDate()); | ||
$archive->setDetails($messageLog->getDetails()); | ||
$archive->setEvent($messageLog->getEvent()); | ||
$archive->setSenderId($sender->getId()); | ||
$archive->setSenderUuid($sender->getUuid()); | ||
$archive->setSenderUsername($sender->getUsername()); | ||
$archive->setReceiverId($receiver->getId()); | ||
$archive->setReceiverUuid($receiver->getUuid()); | ||
$archive->setReceiverUsername($receiver->getUsername()); | ||
|
||
return $archive; | ||
} | ||
|
||
public function getSenderId(): ?int | ||
{ | ||
return $this->senderId; | ||
} | ||
|
||
public function setSenderId(?int $senderId): void | ||
{ | ||
$this->senderId = $senderId; | ||
} | ||
|
||
public function getSenderUuid(): ?string | ||
{ | ||
return $this->senderUuid; | ||
} | ||
|
||
public function setSenderUuid(?string $senderUuid): void | ||
{ | ||
$this->senderUuid = $senderUuid; | ||
} | ||
|
||
public function getSenderUsername(): ?string | ||
{ | ||
return $this->senderUsername; | ||
} | ||
|
||
public function setSenderUsername(?string $senderUsername): void | ||
{ | ||
$this->senderUsername = $senderUsername; | ||
} | ||
|
||
public function getReceiverId(): ?int | ||
{ | ||
return $this->receiverId; | ||
} | ||
|
||
public function setReceiverId(?int $receiverId): void | ||
{ | ||
$this->receiverId = $receiverId; | ||
} | ||
|
||
public function getReceiverUuid(): ?string | ||
{ | ||
return $this->receiverUuid; | ||
} | ||
|
||
public function setReceiverUuid(?string $receiverUuid): void | ||
{ | ||
$this->receiverUuid = $receiverUuid; | ||
} | ||
|
||
public function getReceiverUsername(): ?string | ||
{ | ||
return $this->receiverUsername; | ||
} | ||
|
||
public function setReceiverUsername(?string $receiverUsername): void | ||
{ | ||
$this->receiverUsername = $receiverUsername; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
<?php | ||
|
||
namespace Claroline\LogBundle\Entity\Archive; | ||
|
||
use Claroline\LogBundle\Entity\AbstractLog; | ||
use Claroline\LogBundle\Entity\SecurityLog; | ||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
/** | ||
* @ORM\Entity | ||
* @ORM\Table(null) | ||
*/ | ||
class SecurityLogArchive extends AbstractLog | ||
{ | ||
/** | ||
* @var int|null | ||
* @ORM\Column(type="integer", nullable=true) | ||
*/ | ||
private $doerId; | ||
|
||
/** | ||
* @var string|null | ||
* @ORM\Column(type="string", nullable=true) | ||
*/ | ||
private $doerUuid; | ||
|
||
/** | ||
* @var string|null | ||
* @ORM\Column(type="string", nullable=true) | ||
*/ | ||
private $doerUsername; | ||
|
||
/** | ||
* @var string|null | ||
* @ORM\Column(type="string", nullable=true) | ||
*/ | ||
private $doerIp; | ||
|
||
/** | ||
* @var string|null | ||
* @ORM\Column(type="string", nullable=true) | ||
*/ | ||
private $doerCountry; | ||
|
||
/** | ||
* @var string|null | ||
* @ORM\Column(type="string", nullable=true) | ||
*/ | ||
private $doerCity; | ||
|
||
public static function fromSecurityLog(SecurityLog $securityLog): self | ||
{ | ||
$doer = $securityLog->getDoer(); | ||
|
||
$archive = new self(); | ||
$archive->setEvent($securityLog->getEvent()); | ||
$archive->setDetails($securityLog->getDetails()); | ||
$archive->setDate($securityLog->getDate()); | ||
|
||
if ($doer) { | ||
$archive->setDoerId($doer->getId()); | ||
$archive->setDoerUuid($doer->getUuid()); | ||
$archive->setDoerUsername($doer->getUsername()); | ||
} | ||
|
||
$archive->setDoerIp($securityLog->getDoerIp()); | ||
$archive->setDoerCountry($securityLog->getCountry()); | ||
$archive->setDoerCity($securityLog->getCity()); | ||
|
||
return $archive; | ||
} | ||
|
||
public function getDoerId(): ?int | ||
{ | ||
return $this->doerId; | ||
} | ||
|
||
public function setDoerId(?int $doerId): void | ||
{ | ||
$this->doerId = $doerId; | ||
} | ||
|
||
public function getDoerUuid(): ?string | ||
{ | ||
return $this->doerUuid; | ||
} | ||
|
||
public function setDoerUuid(?string $doerUuid): void | ||
{ | ||
$this->doerUuid = $doerUuid; | ||
} | ||
|
||
public function getDoerUsername(): string | ||
{ | ||
return $this->doerUsername; | ||
} | ||
|
||
public function setDoerUsername(?string $doerUsername): void | ||
{ | ||
$this->doerUsername = $doerUsername; | ||
} | ||
|
||
public function getDoerIp(): ?string | ||
{ | ||
return $this->doerIp; | ||
} | ||
|
||
public function setDoerIp(?string $doerIp): void | ||
{ | ||
$this->doerIp = $doerIp; | ||
} | ||
|
||
public function getDoerCountry(): ?string | ||
{ | ||
return $this->doerCountry; | ||
} | ||
|
||
public function setDoerCountry(?string $doerCountry): void | ||
{ | ||
$this->doerCountry = $doerCountry; | ||
} | ||
|
||
public function getDoerCity(): ?string | ||
{ | ||
return $this->doerCity; | ||
} | ||
|
||
public function setDoerCity(?string $doerCity): void | ||
{ | ||
$this->doerCity = $doerCity; | ||
} | ||
} |