diff options
Diffstat (limited to 'src/Wallabag/ApiBundle/Controller/EntryRestController.php')
-rw-r--r-- | src/Wallabag/ApiBundle/Controller/EntryRestController.php | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index 768c4fdc..93f1f461 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php | |||
@@ -5,6 +5,7 @@ namespace Wallabag\ApiBundle\Controller; | |||
5 | use Hateoas\Configuration\Route; | 5 | use Hateoas\Configuration\Route; |
6 | use Hateoas\Representation\Factory\PagerfantaFactory; | 6 | use Hateoas\Representation\Factory\PagerfantaFactory; |
7 | use Nelmio\ApiDocBundle\Annotation\ApiDoc; | 7 | use Nelmio\ApiDocBundle\Annotation\ApiDoc; |
8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; | ||
8 | use Symfony\Component\HttpKernel\Exception\HttpException; | 9 | use Symfony\Component\HttpKernel\Exception\HttpException; |
9 | use Symfony\Component\HttpFoundation\Request; | 10 | use Symfony\Component\HttpFoundation\Request; |
10 | use Symfony\Component\HttpFoundation\JsonResponse; | 11 | use Symfony\Component\HttpFoundation\JsonResponse; |
@@ -25,7 +26,7 @@ class EntryRestController extends WallabagRestController | |||
25 | * {"name"="urls", "dataType"="string", "required"=false, "format"="An array of urls (?urls[]=http...&urls[]=http...)", "description"="Urls (as an array) to check if it exists"} | 26 | * {"name"="urls", "dataType"="string", "required"=false, "format"="An array of urls (?urls[]=http...&urls[]=http...)", "description"="Urls (as an array) to check if it exists"} |
26 | * } | 27 | * } |
27 | * ) | 28 | * ) |
28 | * | 29 | * @Security("has_role('ROLE_READ')") |
29 | * @return JsonResponse | 30 | * @return JsonResponse |
30 | */ | 31 | */ |
31 | public function getEntriesExistsAction(Request $request) | 32 | public function getEntriesExistsAction(Request $request) |
@@ -80,7 +81,7 @@ class EntryRestController extends WallabagRestController | |||
80 | * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by entries with a public link"}, | 81 | * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0, all entries by default", "description"="filter by entries with a public link"}, |
81 | * } | 82 | * } |
82 | * ) | 83 | * ) |
83 | * | 84 | * @Security("has_role('ROLE_READ')") |
84 | * @return JsonResponse | 85 | * @return JsonResponse |
85 | */ | 86 | */ |
86 | public function getEntriesAction(Request $request) | 87 | public function getEntriesAction(Request $request) |
@@ -143,7 +144,7 @@ class EntryRestController extends WallabagRestController | |||
143 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} | 144 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} |
144 | * } | 145 | * } |
145 | * ) | 146 | * ) |
146 | * | 147 | * @Security("has_role('ROLE_READ')") |
147 | * @return JsonResponse | 148 | * @return JsonResponse |
148 | */ | 149 | */ |
149 | public function getEntryAction(Entry $entry) | 150 | public function getEntryAction(Entry $entry) |
@@ -162,7 +163,7 @@ class EntryRestController extends WallabagRestController | |||
162 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} | 163 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} |
163 | * } | 164 | * } |
164 | * ) | 165 | * ) |
165 | * | 166 | * @Security("has_role('ROLE_READ')") |
166 | * @return Response | 167 | * @return Response |
167 | */ | 168 | */ |
168 | public function getEntryExportAction(Entry $entry, Request $request) | 169 | public function getEntryExportAction(Entry $entry, Request $request) |
@@ -302,7 +303,7 @@ class EntryRestController extends WallabagRestController | |||
302 | * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="will generate a public link for the entry"}, | 303 | * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="will generate a public link for the entry"}, |
303 | * } | 304 | * } |
304 | * ) | 305 | * ) |
305 | * | 306 | * @Security("has_role('ROLE_WRITE')") |
306 | * @return JsonResponse | 307 | * @return JsonResponse |
307 | */ | 308 | */ |
308 | public function postEntriesAction(Request $request) | 309 | public function postEntriesAction(Request $request) |
@@ -346,7 +347,7 @@ class EntryRestController extends WallabagRestController | |||
346 | * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="will generate a public link for the entry"}, | 347 | * {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="will generate a public link for the entry"}, |
347 | * } | 348 | * } |
348 | * ) | 349 | * ) |
349 | * | 350 | * @Security("has_role('ROLE_WRITE')") |
350 | * @return JsonResponse | 351 | * @return JsonResponse |
351 | */ | 352 | */ |
352 | public function patchEntriesAction(Entry $entry, Request $request) | 353 | public function patchEntriesAction(Entry $entry, Request $request) |
@@ -368,7 +369,7 @@ class EntryRestController extends WallabagRestController | |||
368 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} | 369 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} |
369 | * } | 370 | * } |
370 | * ) | 371 | * ) |
371 | * | 372 | * @Security("has_role('ROLE_WRITE')") |
372 | * @return JsonResponse | 373 | * @return JsonResponse |
373 | */ | 374 | */ |
374 | public function patchEntriesReloadAction(Entry $entry) | 375 | public function patchEntriesReloadAction(Entry $entry) |
@@ -410,7 +411,7 @@ class EntryRestController extends WallabagRestController | |||
410 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} | 411 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} |
411 | * } | 412 | * } |
412 | * ) | 413 | * ) |
413 | * | 414 | * @Security("has_role('ROLE_WRITE')") |
414 | * @return JsonResponse | 415 | * @return JsonResponse |
415 | */ | 416 | */ |
416 | public function deleteEntriesAction(Entry $entry) | 417 | public function deleteEntriesAction(Entry $entry) |
@@ -436,7 +437,7 @@ class EntryRestController extends WallabagRestController | |||
436 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} | 437 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} |
437 | * } | 438 | * } |
438 | * ) | 439 | * ) |
439 | * | 440 | * @Security("has_role('ROLE_READ')") |
440 | * @return JsonResponse | 441 | * @return JsonResponse |
441 | */ | 442 | */ |
442 | public function getEntriesTagsAction(Entry $entry) | 443 | public function getEntriesTagsAction(Entry $entry) |
@@ -458,7 +459,7 @@ class EntryRestController extends WallabagRestController | |||
458 | * {"name"="tags", "dataType"="string", "required"=false, "format"="tag1,tag2,tag3", "description"="a comma-separated list of tags."}, | 459 | * {"name"="tags", "dataType"="string", "required"=false, "format"="tag1,tag2,tag3", "description"="a comma-separated list of tags."}, |
459 | * } | 460 | * } |
460 | * ) | 461 | * ) |
461 | * | 462 | * @Security("has_role('ROLE_WRITE')") |
462 | * @return JsonResponse | 463 | * @return JsonResponse |
463 | */ | 464 | */ |
464 | public function postEntriesTagsAction(Request $request, Entry $entry) | 465 | public function postEntriesTagsAction(Request $request, Entry $entry) |
@@ -487,7 +488,7 @@ class EntryRestController extends WallabagRestController | |||
487 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} | 488 | * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} |
488 | * } | 489 | * } |
489 | * ) | 490 | * ) |
490 | * | 491 | * @Security("has_role('ROLE_WRITE')") |
491 | * @return JsonResponse | 492 | * @return JsonResponse |
492 | */ | 493 | */ |
493 | public function deleteEntriesTagsAction(Entry $entry, Tag $tag) | 494 | public function deleteEntriesTagsAction(Entry $entry, Tag $tag) |