mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-23 17:17:43 +00:00
Fix: authorization helper won't send a list of center if an admin is authenticated
This commit is contained in:
parent
0c5a06c678
commit
9918cf2d58
@ -2631,11 +2631,6 @@ parameters:
|
|||||||
count: 2
|
count: 2
|
||||||
path: src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
|
path: src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Call to method getRoleScopes\\(\\) on an unknown class Chill\\\\MainBundle\\\\Entity\\\\PermissionGroup\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Empty array passed to foreach\\.$#"
|
message: "#^Empty array passed to foreach\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
@ -31,7 +31,7 @@ class GroupCenter
|
|||||||
* )
|
* )
|
||||||
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
|
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
|
||||||
*/
|
*/
|
||||||
private $center;
|
private ?Center $center = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
@ -40,83 +40,64 @@ class GroupCenter
|
|||||||
* @ORM\Column(name="id", type="integer")
|
* @ORM\Column(name="id", type="integer")
|
||||||
* @ORM\GeneratedValue(strategy="AUTO")
|
* @ORM\GeneratedValue(strategy="AUTO")
|
||||||
*/
|
*/
|
||||||
private $id;
|
private ?int $id = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var PermissionsGroup
|
|
||||||
*
|
|
||||||
* @ORM\ManyToOne(
|
* @ORM\ManyToOne(
|
||||||
* targetEntity="Chill\MainBundle\Entity\PermissionsGroup",
|
* targetEntity="Chill\MainBundle\Entity\PermissionsGroup",
|
||||||
* inversedBy="groupCenters")
|
* inversedBy="groupCenters")
|
||||||
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
|
* @ORM\Cache(usage="NONSTRICT_READ_WRITE")
|
||||||
*/
|
*/
|
||||||
private $permissionsGroup;
|
private ?PermissionsGroup $permissionsGroup = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Collection
|
|
||||||
*
|
|
||||||
* @ORM\ManyToMany(
|
* @ORM\ManyToMany(
|
||||||
* targetEntity="Chill\MainBundle\Entity\User",
|
* targetEntity="Chill\MainBundle\Entity\User",
|
||||||
* mappedBy="groupCenters"
|
* mappedBy="groupCenters"
|
||||||
* )
|
* )
|
||||||
|
* @var Collection<User::class>
|
||||||
*/
|
*/
|
||||||
private $users;
|
private Collection $users;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GroupCenter constructor.
|
* GroupCenter constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->permissionsGroup = new ArrayCollection();
|
|
||||||
$this->users = new ArrayCollection();
|
$this->users = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getCenter(): ?Center
|
||||||
* @return Center
|
|
||||||
*/
|
|
||||||
public function getCenter()
|
|
||||||
{
|
{
|
||||||
return $this->center;
|
return $this->center;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getId(): ?int
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function getId()
|
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getPermissionsGroup(): ?PermissionsGroup
|
||||||
* @return PermissionGroup
|
|
||||||
*/
|
|
||||||
public function getPermissionsGroup()
|
|
||||||
{
|
{
|
||||||
return $this->permissionsGroup;
|
return $this->permissionsGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return ArrayCollection|Collection
|
* @return Collection<User::class>
|
||||||
*/
|
*/
|
||||||
public function getUsers()
|
public function getUsers(): Collection
|
||||||
{
|
{
|
||||||
return $this->users;
|
return $this->users;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setCenter(Center $center): self
|
||||||
* @return \Chill\MainBundle\Entity\GroupCenter
|
|
||||||
*/
|
|
||||||
public function setCenter(Center $center)
|
|
||||||
{
|
{
|
||||||
$this->center = $center;
|
$this->center = $center;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setPermissionsGroup(PermissionsGroup $permissionsGroup): self
|
||||||
* @return \Chill\MainBundle\Entity\GroupCenter
|
|
||||||
*/
|
|
||||||
public function setPermissionsGroup(PermissionsGroup $permissionsGroup)
|
|
||||||
{
|
{
|
||||||
$this->permissionsGroup = $permissionsGroup;
|
$this->permissionsGroup = $permissionsGroup;
|
||||||
|
|
||||||
|
@ -120,6 +120,11 @@ class AuthorizationHelper implements AuthorizationHelperInterface
|
|||||||
if ($role instanceof Role) {
|
if ($role instanceof Role) {
|
||||||
$role = $role->getRole();
|
$role = $role->getRole();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$user instanceof User) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
/** @var array<string, Center> $centers */
|
/** @var array<string, Center> $centers */
|
||||||
$centers = [];
|
$centers = [];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user