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;
|
||||
}
|
||||
|
||||
protected function getSupportedAttributes()
|
||||
private function getAttributes()
|
||||
{
|
||||
return array(self::STATS, self::LISTS);
|
||||
}
|
||||
@ -54,6 +54,17 @@ class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierar
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -66,12 +77,12 @@ class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierar
|
||||
|
||||
public function getRoles()
|
||||
{
|
||||
return $this->getSupportedAttributes();
|
||||
return $this->getAttributes();
|
||||
}
|
||||
|
||||
public function getRolesWithoutScope()
|
||||
{
|
||||
return $this->getSupportedAttributes();
|
||||
return $this->getAttributes();
|
||||
}
|
||||
|
||||
public function getRolesWithHierarchy()
|
||||
|
@ -55,10 +55,7 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
if ($subject instanceof Activity) {
|
||||
return \in_array($attribute, [
|
||||
self::CREATE, self::SEE, self::UPDATE, self::DELETE,
|
||||
self::SEE_DETAILS
|
||||
]);
|
||||
return \in_array($attribute, $this->getAttributes());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@ -71,11 +68,17 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
||||
}
|
||||
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()
|
||||
{
|
||||
return $this->getSupportedAttributes();
|
||||
return $this->getAttributes();
|
||||
}
|
||||
|
||||
public function getRolesWithoutScope()
|
||||
|
Loading…
x
Reference in New Issue
Block a user