mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Feature: an activity has the same scope as an accompanying period, if it exists
This commit is contained in:
parent
3785e5096e
commit
93560a62ef
@ -17,7 +17,7 @@ use Chill\MainBundle\Entity\Center;
|
|||||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||||
use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
|
use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
|
||||||
use Chill\MainBundle\Entity\HasCenterInterface;
|
use Chill\MainBundle\Entity\HasCenterInterface;
|
||||||
use Chill\MainBundle\Entity\HasScopeInterface;
|
use Chill\MainBundle\Entity\HasScopesInterface;
|
||||||
use Chill\MainBundle\Entity\Location;
|
use Chill\MainBundle\Entity\Location;
|
||||||
use Chill\MainBundle\Entity\Scope;
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
@ -55,7 +55,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
* getUserFunction="getUser",
|
* getUserFunction="getUser",
|
||||||
* path="scope")
|
* path="scope")
|
||||||
*/
|
*/
|
||||||
class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, HasCenterInterface, HasScopeInterface
|
class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, HasCenterInterface, HasScopesInterface
|
||||||
{
|
{
|
||||||
public const SENTRECEIVED_RECEIVED = 'received';
|
public const SENTRECEIVED_RECEIVED = 'received';
|
||||||
|
|
||||||
@ -422,6 +422,19 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
return $this->scope;
|
return $this->scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getScopes(): array
|
||||||
|
{
|
||||||
|
if (null !== $this->getAccompanyingPeriod()) {
|
||||||
|
return $this->getAccompanyingPeriod()->getScopes();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== $this->getPerson()) {
|
||||||
|
return [$this->scope];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
public function getSentReceived(): string
|
public function getSentReceived(): string
|
||||||
{
|
{
|
||||||
return $this->sentReceived;
|
return $this->sentReceived;
|
||||||
|
@ -133,7 +133,7 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
|||||||
|
|
||||||
// change attribute CREATE
|
// change attribute CREATE
|
||||||
if (self::CREATE === $attribute) {
|
if (self::CREATE === $attribute) {
|
||||||
return $this->voterHelper->voteOnAttribute(self::CREATE_PERSON, null, $token);
|
return $this->voterHelper->voteOnAttribute(self::CREATE_PERSON, $subject->getPerson(), $token);
|
||||||
}
|
}
|
||||||
} elseif ($subject->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
|
} elseif ($subject->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
|
||||||
if (!$this->security->isGranted(AccompanyingPeriodVoter::SEE, $subject->getAccompanyingPeriod())) {
|
if (!$this->security->isGranted(AccompanyingPeriodVoter::SEE, $subject->getAccompanyingPeriod())) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user