|
|
@@ -14,6 +14,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
|
|
use Doctrine\Common\Collections\Collection;
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
use Symfony\Component\Security\Core\User\UserInterface;
|
|
|
+use Symfony\Component\Serializer\Annotation\Groups;
|
|
|
|
|
|
/**
|
|
|
* Fais le lien entre une Person et une Organization
|
|
|
@@ -32,7 +33,7 @@ use Symfony\Component\Security\Core\User\UserInterface;
|
|
|
* },
|
|
|
* itemOperations={
|
|
|
* "get"={"security"="(is_granted('ROLE_USERS_VIEW') and object.getOrganization().getId() == user.getOrganization().getId()) or (object.getId() == user.getId())"},
|
|
|
- * "put"={"security"="is_granted('ROLE_USERS')"},
|
|
|
+ * "put"={"security"="is_granted('ROLE_USERS') or (object.getId() == user.getId())"},
|
|
|
* "delete"
|
|
|
* }
|
|
|
* )
|
|
|
@@ -70,11 +71,21 @@ class Access implements UserInterface
|
|
|
public $organization;
|
|
|
|
|
|
/**
|
|
|
- * @var array
|
|
|
* @ORM\Column(type="json_array", length=4294967295, nullable=true)
|
|
|
*/
|
|
|
private $roles = [];
|
|
|
|
|
|
+ /**
|
|
|
+ * @Groups({"my_access:input"})
|
|
|
+ * @ORM\Column(type="json_array", length=4294967295, nullable=true)
|
|
|
+ */
|
|
|
+ private $setting;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Groups({"my_access:input"})
|
|
|
+ */
|
|
|
+ private $historical;
|
|
|
+
|
|
|
/**
|
|
|
* @var ArrayCollection<PersonActivity>
|
|
|
* @ORM\OneToMany(targetEntity=PersonActivity::class, mappedBy="access", orphanRemoval=true, cascade={"persist"})
|
|
|
@@ -254,12 +265,35 @@ class Access implements UserInterface
|
|
|
/**
|
|
|
* @inheritDoc
|
|
|
*/
|
|
|
- public function getRoles()
|
|
|
+ public function getRoles(): array
|
|
|
{
|
|
|
$roles = $this->roles;
|
|
|
return array_unique($roles);
|
|
|
}
|
|
|
|
|
|
+ public function setSetting(array $setting): self
|
|
|
+ {
|
|
|
+ $this->setting = $setting;
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public function getSetting(): array
|
|
|
+ {
|
|
|
+ return $this->setting;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getHistorical(): array
|
|
|
+ {
|
|
|
+ return $this->setting['historical'] ?? [];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function setHistorical(array $historical): self
|
|
|
+ {
|
|
|
+ $this->setting['historical'] = $historical;
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @inheritDoc
|
|
|
*/
|