Skip to content

Release/0.19.0 #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7caa21b
Add property-based permission scope
marioprudhomme Jul 30, 2020
4d9db3d
Add multi-scope permissions
marioprudhomme Aug 1, 2020
4c23716
Synchronize migration with doctrine metadata
marioprudhomme Aug 2, 2020
d04780a
Convert business units role association into a broader entity uuids r…
marioprudhomme Aug 3, 2020
71631e9
Add feature toggler for token identity business units field
marioprudhomme Aug 3, 2020
b033855
Fix isset check regarding user creation from jwt token payload
marioprudhomme Aug 3, 2020
d45efdc
Add business unit role api service and related resources
marioprudhomme Aug 3, 2020
f2a5b59
Add business unit roles to jwt token roles
marioprudhomme Aug 3, 2020
e9bfff6
Remove attribute from the wrong array level
marioprudhomme Aug 3, 2020
7ffdb4a
Refactor api permission scope property.
marioprudhomme Aug 5, 2020
ac3da6f
Fix type-casting of jwt payload
marioprudhomme Aug 6, 2020
0b52f28
Add tenant 0 jwt tokens for tests
marioprudhomme Aug 9, 2020
3598ccd
Fix yaml tabbing
marioprudhomme Aug 9, 2020
0a194ec
Add user with role option to behat authenticated given statement
marioprudhomme Aug 9, 2020
a719401
Add reflection to behat context
marioprudhomme Aug 9, 2020
91023be
Fix acl voters array vs object typecast with scalar translations
marioprudhomme Aug 9, 2020
3ac6aaf
Fix path regarding array vs object for nested json properties
marioprudhomme Aug 9, 2020
9d74194
Add like comparison to acl property scope
marioprudhomme Aug 9, 2020
43e1155
Add specific locale to acl query building
marioprudhomme Aug 10, 2020
4d12bb6
Enable camunda api component to filter by multiple candidate groups
marioprudhomme Aug 23, 2020
124ae7b
Enable write acl on created_at entity properties
marioprudhomme Aug 30, 2020
322526c
Add created_at and updated_at config acl permissions
marioprudhomme Aug 30, 2020
c762a4f
Update fixtures related to created_at properties
marioprudhomme Aug 30, 2020
a2ee64b
Map unassigned camunda query parameter to tasks endpoint
marioprudhomme Sep 2, 2020
ddd320c
Further map camunda api component
marioprudhomme Sep 10, 2020
eb6d93c
Fix camunda integration tasks pagination
marioprudhomme Sep 17, 2020
88c93f4
Add created and due asc/desc filters on tasksByUuids camunda tasks se…
marioprudhomme Nov 21, 2020
1eb1659
Add pagination filters to custom task search endpoint for camunda
marioprudhomme Nov 25, 2020
0a131af
Disable pagination for task-by-ids custom camunda endpoint
marioprudhomme May 9, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
565 changes: 429 additions & 136 deletions src/Acl/Doctrine/ORM/QueryExtension/EntityExtension.php

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions src/Acl/Entity/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
* @ApiResource(
* attributes={
* "normalization_context"={
* "groups"={"access_output", "permission_output", "scope_output"}
* "groups"={"access_output", "permission_output"}
* },
* "denormalization_context"={
* "groups"={"access_input", "permission_input", "scope_input"}
* "groups"={"access_input", "permission_input"}
* },
* "filters"={
* "ds_acl.access.search",
Expand Down Expand Up @@ -80,8 +80,9 @@ class Access implements Identifiable, Uuidentifiable, Ownable, Assignable, Versi

/**
* @var \DateTime
* @ApiProperty(writable=false)
* @Serializer\Groups({"access_output"})
* @ApiProperty
* @Serializer\Groups({"access_output", "access_input"})
* @Assert\DateTime
*/
protected $createdAt;

Expand Down
43 changes: 0 additions & 43 deletions src/Acl/Entity/Attribute/Accessor/Entity.php

This file was deleted.

43 changes: 0 additions & 43 deletions src/Acl/Entity/Attribute/Accessor/EntityUuid.php

This file was deleted.

53 changes: 48 additions & 5 deletions src/Acl/Entity/Attribute/Accessor/Scope.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Ds\Component\Acl\Entity\Attribute\Accessor;

use Ds\Component\Acl\Entity\Scope as ScopeEntity;
use LogicException;

/**
* Trait Scope
Expand All @@ -14,10 +14,11 @@ trait Scope
/**
* Set scope
*
* @param \Ds\Component\Acl\Entity\Scope $scope
* @param array $scope
* @return object
* @throws
*/
public function setScope(?ScopeEntity $scope)
public function setScope(?array $scope)
{
$this->scope = $scope;

Expand All @@ -27,10 +28,52 @@ public function setScope(?ScopeEntity $scope)
/**
* Get scope
*
* @return \Ds\Component\Acl\Entity\Scope
* @return array
*/
public function getScope(): ?ScopeEntity
public function getScope(): ?array
{
return $this->scope;
}

/**
* Get scope operator
*
* @return string
*/
public function getScopeOperator(): ?string
{
$operator = 'and';

if (isset($this->scope['operator'])) {
if (!in_array($this->scope['operator'], ['and', 'or'], true)) {
throw new LogicException('Permission scope operator is not valid.');
}

$operator = $this->scope['operator'];
}

return $operator;
}

/**
* Get scope conditions
*
* @return array
*/
public function getScopeConditions(): array
{
$conditions = [];

if (isset($this->scope['conditions'])) {
if (!is_array($this->scope['conditions'])) {
throw new LogicException('Permission scope consitions is not valid.');
}

$conditions = $this->scope['conditions'];
} else if ($this->scope) {
$conditions = [$this->scope];
}

return $conditions;
}
}
64 changes: 0 additions & 64 deletions src/Acl/Entity/Attribute/Accessor/Type.php

This file was deleted.

16 changes: 8 additions & 8 deletions src/Acl/Entity/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
class Permission implements Identifiable, Tenantable
{
use Accessor\Id;
use EntityAccessor\Scope;
use EntityAccessor\Access;
use Accessor\Key;
use Accessor\Type;
use Accessor\Value;
use Accessor\Attributes;
use EntityAccessor\Scope;
use TenantAccessor\Tenant;

/**
Expand All @@ -48,13 +48,6 @@ class Permission implements Identifiable, Tenantable
*/
private $access;

/**
* @var string
* @Serializer\Groups({"permission_output", "permission_input"})
* @ORM\Embedded(class="Scope")
*/
private $scope;

/**
* @var string
* @Serializer\Groups({"permission_output", "permission_input"})
Expand Down Expand Up @@ -86,6 +79,13 @@ class Permission implements Identifiable, Tenantable
*/
private $attributes;

/**
* @var string
* @Serializer\Groups({"permission_output", "permission_input"})
* @ORM\Column(name="scope", type="json_array")
*/
private $scope;

/**
* @var string
* @ORM\Column(name="tenant", type="guid")
Expand Down
52 changes: 0 additions & 52 deletions src/Acl/Entity/Scope.php

This file was deleted.

3 changes: 2 additions & 1 deletion src/Acl/EventListener/ExceptionListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public function kernelException(GetResponseForExceptionEvent $event)

// In the event a user requests a list of entities and has no permissions,
// an empty list is returned.
$response = new JsonResponse([]);
$response = new JsonResponse([], 200);
$event->setResponse($response);
$event->allowCustomResponseCode();
}
}
8 changes: 8 additions & 0 deletions src/Acl/Fixture/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Ds\Component\Acl\Fixture;

use DateTime;
use Doctrine\Common\Persistence\ObjectManager;
use Ds\Component\Acl\Entity\Access as AccessEntity;
use Ds\Component\Database\Fixture\Yaml;
Expand Down Expand Up @@ -36,6 +37,13 @@ public function load(ObjectManager $manager)
->setAssignee($object->assignee)
->setAssigneeUuid($object->assignee_uuid)
->setTenant($object->tenant);

if (null !== $object->created_at) {
$date = new DateTime;
$date->setTimestamp($object->created_at);
$access->setCreatedAt($date);
}

$manager->persist($access);
}

Expand Down
Loading