fixed: ACL in activity creations and edition

This commit is contained in:
2022-07-11 18:24:48 +02:00
parent 93560a62ef
commit ce17c15d41
4 changed files with 18 additions and 13 deletions

View File

@@ -17,6 +17,7 @@ use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\HasCentersInterface;
use Chill\MainBundle\Entity\HasScopesInterface;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\Scope;
@@ -55,7 +56,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* getUserFunction="getUser",
* path="scope")
*/
class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, HasCenterInterface, HasScopesInterface
class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, HasCentersInterface, HasScopesInterface
{
public const SENTRECEIVED_RECEIVED = 'received';
@@ -306,13 +307,15 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
* get the center
* center is extracted from person.
*/
public function getCenter(): ?Center
public function getCenters(): array
{
if ($this->person instanceof Person) {
return $this->person->getCenter();
return [$this->person->getCenter()];
} elseif ($this->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
return $this->getAccompanyingPeriod()->getCenters();
}
return null;
return [];
}
public function getComment(): CommentEmbeddable
@@ -422,7 +425,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
return $this->scope;
}
public function getScopes(): array
public function getScopes(): iterable
{
if (null !== $this->getAccompanyingPeriod()) {
return $this->getAccompanyingPeriod()->getScopes();