mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix invocation of old method and upgrade ActivitySTatVoter to sf3
This commit is contained in:
parent
ea5d3f7940
commit
b84a77d9de
@ -45,7 +45,7 @@ class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierar
|
|||||||
$this->helper = $helper;
|
$this->helper = $helper;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getSupportedAttributes()
|
private function getAttributes()
|
||||||
{
|
{
|
||||||
return array(self::STATS, self::LISTS);
|
return array(self::STATS, self::LISTS);
|
||||||
}
|
}
|
||||||
@ -54,6 +54,17 @@ class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierar
|
|||||||
{
|
{
|
||||||
return array(Center::class);
|
return array(Center::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function supports($attribute, $subject)
|
||||||
|
{
|
||||||
|
if ($subject instanceof Center
|
||||||
|
&& \in_array($attribute, $this->getAttributes())) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected function isGranted($attribute, $object, $user = null)
|
protected function isGranted($attribute, $object, $user = null)
|
||||||
{
|
{
|
||||||
@ -66,12 +77,12 @@ class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierar
|
|||||||
|
|
||||||
public function getRoles()
|
public function getRoles()
|
||||||
{
|
{
|
||||||
return $this->getSupportedAttributes();
|
return $this->getAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRolesWithoutScope()
|
public function getRolesWithoutScope()
|
||||||
{
|
{
|
||||||
return $this->getSupportedAttributes();
|
return $this->getAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRolesWithHierarchy()
|
public function getRolesWithHierarchy()
|
||||||
|
@ -55,10 +55,7 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
|||||||
protected function supports($attribute, $subject)
|
protected function supports($attribute, $subject)
|
||||||
{
|
{
|
||||||
if ($subject instanceof Activity) {
|
if ($subject instanceof Activity) {
|
||||||
return \in_array($attribute, [
|
return \in_array($attribute, $this->getAttributes());
|
||||||
self::CREATE, self::SEE, self::UPDATE, self::DELETE,
|
|
||||||
self::SEE_DETAILS
|
|
||||||
]);
|
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -71,11 +68,17 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
|||||||
}
|
}
|
||||||
return $this->helper->userHasAccess($token->getUser(), $subject, $attribute);
|
return $this->helper->userHasAccess($token->getUser(), $subject, $attribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getAttributes()
|
||||||
|
{
|
||||||
|
return [ self::CREATE, self::SEE, self::UPDATE, self::DELETE,
|
||||||
|
self::SEE_DETAILS ];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getRoles()
|
public function getRoles()
|
||||||
{
|
{
|
||||||
return $this->getSupportedAttributes();
|
return $this->getAttributes();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRolesWithoutScope()
|
public function getRolesWithoutScope()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user