1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-10-05 19:31:02 +00:00

Remove voter & add tests

This commit is contained in:
Jeremy Benoist 2025-10-02 11:54:12 +02:00
parent 7e7674a4a6
commit 5629330cb6
No known key found for this signature in database
GPG key ID: 7168D5DD29F38552
29 changed files with 269 additions and 154 deletions

View file

@ -27,9 +27,12 @@ class PocketController extends AbstractController
#[Route(path: '/import/pocket', name: 'import_pocket', methods: ['GET'])]
#[IsGranted('IMPORT_ENTRIES')]
#[IsGranted('USE_IMPORTER', subject: 'pocketImport')]
public function indexAction(PocketImport $pocketImport)
{
if (!$pocketImport->isEnabled()) {
throw $this->createNotFoundException('Import is disabled');
}
$pocket = $this->getPocketImportService($pocketImport);
$form = $this->createFormBuilder($pocket)
@ -48,9 +51,12 @@ class PocketController extends AbstractController
#[Route(path: '/import/pocket/auth', name: 'import_pocket_auth', methods: ['POST'])]
#[IsGranted('IMPORT_ENTRIES')]
#[IsGranted('USE_IMPORTER', subject: 'pocketImport')]
public function authAction(Request $request, PocketImport $pocketImport)
{
if (!$pocketImport->isEnabled()) {
throw $this->createNotFoundException('Import is disabled');
}
$requestToken = $this->getPocketImportService($pocketImport)
->getRequestToken($this->generateUrl('import', [], UrlGeneratorInterface::ABSOLUTE_URL));
@ -78,9 +84,12 @@ class PocketController extends AbstractController
#[Route(path: '/import/pocket/callback', name: 'import_pocket_callback', methods: ['GET'])]
#[IsGranted('IMPORT_ENTRIES')]
#[IsGranted('USE_IMPORTER', subject: 'pocketImport')]
public function callbackAction(PocketImport $pocketImport, TranslatorInterface $translator)
{
if (!$pocketImport->isEnabled()) {
throw $this->createNotFoundException('Import is disabled');
}
$message = 'flashes.import.notice.failed';
$pocket = $this->getPocketImportService($pocketImport);