|
@@ -3,6 +3,9 @@ declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace App\Entity\Access;
|
|
namespace App\Entity\Access;
|
|
|
|
|
|
|
|
|
|
+use ApiPlatform\Core\Annotation\ApiFilter;
|
|
|
|
|
+use App\Filter\Person\FullNameFilter;
|
|
|
|
|
+use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter;
|
|
|
use ApiPlatform\Core\Annotation\ApiResource;
|
|
use ApiPlatform\Core\Annotation\ApiResource;
|
|
|
use ApiPlatform\Core\Annotation\ApiSubresource;
|
|
use ApiPlatform\Core\Annotation\ApiSubresource;
|
|
|
use App\Entity\Billing\AccessIntangible;
|
|
use App\Entity\Billing\AccessIntangible;
|
|
@@ -23,36 +26,17 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Fais le lien entre une Person et une Organization
|
|
* Fais le lien entre une Person et une Organization
|
|
|
|
|
+ * @ApiResource @see : config/api_platform/Access/access.yaml
|
|
|
*/
|
|
*/
|
|
|
-#[ApiResource(
|
|
|
|
|
- collectionOperations:[
|
|
|
|
|
- 'cget_students'=> [
|
|
|
|
|
- 'method' => 'GET',
|
|
|
|
|
- 'path' => '/students',
|
|
|
|
|
- 'security' => 'is_granted("ROLE_USERS_VIEW")'
|
|
|
|
|
- ],
|
|
|
|
|
- 'cget_admin'=> [
|
|
|
|
|
- 'method' => 'GET',
|
|
|
|
|
- 'path' => '/admin'
|
|
|
|
|
- ],
|
|
|
|
|
- 'get'
|
|
|
|
|
- ],
|
|
|
|
|
- itemOperations: [
|
|
|
|
|
- 'get' => [
|
|
|
|
|
- 'security' => '(is_granted("ROLE_USERS_VIEW") and object.getOrganization().getId() == user.getOrganization().getId()) or (object.getId() == user.getId())'
|
|
|
|
|
- ],
|
|
|
|
|
- 'put' => [
|
|
|
|
|
- 'security' => 'is_granted("ROLE_USERS") or (object.getId() == user.getId())'
|
|
|
|
|
- ],
|
|
|
|
|
- 'delete'
|
|
|
|
|
- ]
|
|
|
|
|
-)]
|
|
|
|
|
#[ORM\Entity(repositoryClass: AccessRepository::class)]
|
|
#[ORM\Entity(repositoryClass: AccessRepository::class)]
|
|
|
|
|
+#[ApiFilter(BooleanFilter::class, properties: ['person.isPhysical'])]
|
|
|
|
|
+#[ApiFilter(FullNameFilter::class)]
|
|
|
class Access implements UserInterface
|
|
class Access implements UserInterface
|
|
|
{
|
|
{
|
|
|
#[ORM\Id]
|
|
#[ORM\Id]
|
|
|
#[ORM\Column]
|
|
#[ORM\Column]
|
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\GeneratedValue]
|
|
|
|
|
+ #[Groups("access_people_ref")]
|
|
|
private ?int $id = null;
|
|
private ?int $id = null;
|
|
|
|
|
|
|
|
#[ORM\Column(options: ['default' => false])]
|
|
#[ORM\Column(options: ['default' => false])]
|
|
@@ -68,6 +52,7 @@ class Access implements UserInterface
|
|
|
|
|
|
|
|
#[ORM\ManyToOne(cascade: ['persist'])]
|
|
#[ORM\ManyToOne(cascade: ['persist'])]
|
|
|
#[ORM\JoinColumn(nullable: false)]
|
|
#[ORM\JoinColumn(nullable: false)]
|
|
|
|
|
+ #[Groups(["access_people_ref", "access_address"])]
|
|
|
private Person $person;
|
|
private Person $person;
|
|
|
|
|
|
|
|
#[ORM\ManyToOne]
|
|
#[ORM\ManyToOne]
|