Skip to content
Permalink
Browse files

Parameterize uuid regex (#159)

* refactor: parameterize uuid regex
  • Loading branch information...
antja0 authored and tarlepp committed Oct 4, 2019
1 parent 1b1cf9d commit 8b793d56af14571ae5f701a168335adaabe705fc
Showing with 38 additions and 37 deletions.
  1. +1 −0 config/services.yaml
  2. +7 −7 src/Controller/UserController.php
  3. +5 −5 src/Controller/UserGroupController.php
  4. +1 −1 src/Request/ParamConverter/RestResourceConverter.php
  5. +1 −1 src/Rest/Traits/Actions/Admin/DeleteAction.php
  6. +1 −1 src/Rest/Traits/Actions/Admin/FindOneAction.php
  7. +1 −1 src/Rest/Traits/Actions/Admin/PatchAction.php
  8. +1 −1 src/Rest/Traits/Actions/Admin/UpdateAction.php
  9. +1 −1 src/Rest/Traits/Actions/Anon/DeleteAction.php
  10. +1 −1 src/Rest/Traits/Actions/Anon/FindOneAction.php
  11. +1 −1 src/Rest/Traits/Actions/Anon/PatchAction.php
  12. +1 −1 src/Rest/Traits/Actions/Anon/UpdateAction.php
  13. +1 −1 src/Rest/Traits/Actions/Authenticated/DeleteAction.php
  14. +1 −1 src/Rest/Traits/Actions/Authenticated/FindOneAction.php
  15. +1 −1 src/Rest/Traits/Actions/Authenticated/PatchAction.php
  16. +1 −1 src/Rest/Traits/Actions/Authenticated/UpdateAction.php
  17. +1 −1 src/Rest/Traits/Actions/Logged/DeleteAction.php
  18. +1 −1 src/Rest/Traits/Actions/Logged/FindOneAction.php
  19. +1 −1 src/Rest/Traits/Actions/Logged/PatchAction.php
  20. +1 −1 src/Rest/Traits/Actions/Logged/UpdateAction.php
  21. +1 −1 src/Rest/Traits/Actions/Root/DeleteAction.php
  22. +1 −1 src/Rest/Traits/Actions/Root/FindOneAction.php
  23. +1 −1 src/Rest/Traits/Actions/Root/PatchAction.php
  24. +1 −1 src/Rest/Traits/Actions/Root/UpdateAction.php
  25. +1 −1 src/Rest/Traits/Actions/User/DeleteAction.php
  26. +1 −1 src/Rest/Traits/Actions/User/FindOneAction.php
  27. +1 −1 src/Rest/Traits/Actions/User/PatchAction.php
  28. +1 −1 src/Rest/Traits/Actions/User/UpdateAction.php
@@ -9,6 +9,7 @@ parameters:
env(JWT_PUBLIC_KEY_PATH): '%env(string:key:JWT_PUBLIC_KEY:json:file:APPLICATION_CONFIG)%'
env(CORS_ALLOW_ORIGIN): '%env(string:key:CORS_ALLOW_ORIGIN:json:file:APPLICATION_CONFIG)%'
locale: 'en'
app.uuid_regex: '^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'

services:
# default configuration for services in *this* file
@@ -79,7 +79,7 @@ public function __construct(UserResource $resource)
* @Route(
* "/{requestUser}",
* requirements={
* "requestUser" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "requestUser" = "%app.uuid_regex%",
* },
* methods={"DELETE"},
* )
@@ -116,7 +116,7 @@ public function deleteAction(Request $request, User $requestUser, User $currentU
* @Route(
* "/{requestUser}/roles",
* requirements={
* "requestUser" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "requestUser" = "%app.uuid_regex%",
* },
* methods={"GET"},
* )
@@ -187,7 +187,7 @@ public function getUserRolesAction(User $requestUser, RolesService $roles): Json
* @Route(
* "/{requestUser}/groups",
* requirements={
* "requestUser" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "requestUser" = "%app.uuid_regex%",
* },
* methods={"GET"},
* )
@@ -263,8 +263,8 @@ public function getUserGroupsAction(User $requestUser, SerializerInterface $seri
* @Route(
* "/{user}/group/{userGroup}",
* requirements={
* "user" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "userGroup" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "user" = "%app.uuid_regex%",
* "userGroup" = "%app.uuid_regex%",
* },
* methods={"POST"},
* )
@@ -383,8 +383,8 @@ public function attachUserGroupAction(
* @Route(
* "/{user}/group/{userGroup}",
* requirements={
* "user" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "userGroup" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "user" = "%app.uuid_regex%",
* "userGroup" = "%app.uuid_regex%",
* },
* methods={"DELETE"},
* )
@@ -78,7 +78,7 @@ public function __construct(UserGroupResource $resource)
* @Route(
* "/{userGroup}/users",
* requirements={
* "userGroup" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "userGroup" = "%app.uuid_regex%",
* },
* methods={"GET"},
* )
@@ -146,8 +146,8 @@ public function getUserGroupUsersAction(
* @Route(
* "/{userGroup}/user/{user}",
* requirements={
* "userGroup" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "user" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "userGroup" = "%app.uuid_regex%",
* "user" = "%app.uuid_regex%",
* },
* methods={"POST"},
* )
@@ -253,8 +253,8 @@ public function attachUserAction(
* @Route(
* "/{userGroup}/user/{user}",
* requirements={
* "userGroupId" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "userId" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "userGroupId" = "%app.uuid_regex%",
* "userId" = "%app.uuid_regex%",
* },
* methods={"DELETE"},
* )
@@ -24,7 +24,7 @@
* * @Route(
* * "/{userEntity}",
* * requirements={
* * "userEntity" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* * "userEntity" = "%app.uuid_regex%",
* * }
* * )
* *
@@ -36,7 +36,7 @@ trait DeleteAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"DELETE"},
* )
@@ -36,7 +36,7 @@ trait FindOneAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"GET"},
* )
@@ -36,7 +36,7 @@ trait PatchAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"PATCH"},
* )
@@ -36,7 +36,7 @@ trait UpdateAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"PUT"},
* )
@@ -35,7 +35,7 @@ trait DeleteAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"DELETE"},
* )
@@ -35,7 +35,7 @@ trait FindOneAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"GET"},
* )
@@ -35,7 +35,7 @@ trait PatchAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"PATCH"},
* )
@@ -35,7 +35,7 @@ trait UpdateAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"PUT"},
* )
@@ -36,7 +36,7 @@ trait DeleteAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"DELETE"},
* )
@@ -36,7 +36,7 @@ trait FindOneAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"GET"},
* )
@@ -36,7 +36,7 @@ trait PatchAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"PATCH"},
* )
@@ -36,7 +36,7 @@ trait UpdateAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"PUT"},
* )
@@ -36,7 +36,7 @@ trait DeleteAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"DELETE"},
* )
@@ -36,7 +36,7 @@ trait FindOneAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"GET"},
* )
@@ -36,7 +36,7 @@ trait PatchAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"PATCH"},
* )
@@ -36,7 +36,7 @@ trait UpdateAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"PUT"},
* )
@@ -36,7 +36,7 @@ trait DeleteAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"DELETE"},
* )
@@ -36,7 +36,7 @@ trait FindOneAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"GET"},
* )
@@ -36,7 +36,7 @@ trait PatchAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"PATCH"},
* )
@@ -36,7 +36,7 @@ trait UpdateAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"PUT"},
* )
@@ -36,7 +36,7 @@ trait DeleteAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"DELETE"},
* )
@@ -36,7 +36,7 @@ trait FindOneAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"GET"},
* )
@@ -36,7 +36,7 @@ trait PatchAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"PATCH"},
* )
@@ -36,7 +36,7 @@ trait UpdateAction
* @Route(
* "/{id}",
* requirements={
* "id" = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$",
* "id" = "%app.uuid_regex%",
* },
* methods={"PUT"},
* )

0 comments on commit 8b793d5

Please sign in to comment.
You can’t perform that action at this time.