Skip to content
Snippets Groups Projects
Commit ccbd702c authored by catch's avatar catch
Browse files

Issue #2706241 by mglaman, Spokje, Chi, DamienMcKenna, JeroenT, ankithashetty,...

Issue #2706241 by mglaman, Spokje, Chi, DamienMcKenna, JeroenT, ankithashetty, lslinnet, george.karaivanov, Rade, rteijeiro, nplowman, Wim Leers: AccessAwareRouter does not respect HTTP method

(cherry picked from commit c050f6e9)
parent 60b86d58
No related branches found
No related tags found
17 merge requests!11628Update file MediaLibraryWidget.php,!7564Revert "Issue #3364773 by roshnichordiya, Chris Matthews, thakurnishant_06,...,!5752Issue #3275828 by joachim, quietone, bradjones1, Berdir: document the reason...,!5627Issue #3261805: Field not saved when change of 0 on string start,!5427Issue #3338518: send credentials in ajax if configured in CORS settings.,!5395Issue #3387916 by fjgarlin, Spokje: Each GitLab job exposes user email,!5217Issue #3386607 by alexpott: Improve spell checking in commit-code-check.sh,!5064Issue #3379522 by finnsky, Gauravvvv, kostyashupenko, smustgrave, Chi: Revert...,!5040SDC ComponentElement: Transform slots scalar values to #plain_text instead of throwing an exception,!4958Issue #3392147: Whitelist IP for a Ban module.,!4894Issue #3280279: Add API to allow sites to opt in to upload SVG images in CKEditor 5,!4857Issue #3336994: StringFormatter always displays links to entity even if the user in context does not have access,!4856Issue #3336994: StringFormatter always displays links to entity even if the user in context does not have access,!3679Issue #115801: Allow password on registration without disabling e-mail verification,!3106Issue #3017548: "Filtered HTML" text format does not support manual teaser break (<!--break-->),!925Issue #2339235: Remove taxonomy hard dependency on node module,!872Draft: Issue #3221319: Race condition when creating menu links and editing content deletes menu links
Pipeline #21032 passed
Pipeline: drupal

#21038

    Pipeline: drupal

    #21037

      Pipeline: drupal

      #21036

        ......@@ -10,8 +10,8 @@
        use Drupal\Core\Routing\RouteObjectInterface;
        use Symfony\Component\DependencyInjection\ContainerInterface;
        use Symfony\Component\HttpFoundation\Request;
        use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
        use Symfony\Component\Routing\Exception\ResourceNotFoundException;
        use Symfony\Component\HttpKernel\Exception\HttpException;
        use Symfony\Component\Routing\Exception\ExceptionInterface;
        use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
        /**
        ......@@ -137,10 +137,7 @@ protected function isAdminPath(Request $request) {
        $path = $this->pathProcessorManager->processInbound(urldecode(rtrim($cloned_request->getPathInfo(), '/')), $cloned_request);
        $attributes = $this->router->match($path);
        }
        catch (ResourceNotFoundException $e) {
        return FALSE;
        }
        catch (AccessDeniedHttpException $e) {
        catch (ExceptionInterface | HttpException) {
        return FALSE;
        }
        $route_object = $attributes[RouteObjectInterface::ROUTE_OBJECT];
        ......
        <?php
        namespace Drupal\user_language_test\Controller;
        /**
        * Returns responses for User Language Test routes.
        */
        class UserLanguageTestController {
        /**
        * Builds the response.
        */
        public function buildPostResponse() {
        return ['#markup' => 'It works!'];
        }
        }
        <?php
        namespace Drupal\user_language_test\Form;
        use Drupal\Core\Form\FormBase;
        use Drupal\Core\Form\FormStateInterface;
        use Drupal\Core\Url;
        /**
        * Provides a User Language Test form.
        */
        class UserLanguageTestForm extends FormBase {
        /**
        * {@inheritdoc}
        */
        public function getFormId() {
        return 'user_language_test';
        }
        /**
        * {@inheritdoc}
        */
        public function buildForm(array $form, FormStateInterface $form_state) {
        $form['#action'] = Url::fromRoute('user_language_test.post_response')->toString();
        $form['actions'] = [
        '#type' => 'actions',
        'submit' => [
        '#type' => 'submit',
        '#value' => $this->t('Send'),
        ],
        ];
        return $form;
        }
        /**
        * {@inheritdoc}
        */
        public function submitForm(array &$form, FormStateInterface $form_state) {
        }
        }
        name: 'User language tests'
        type: module
        description: 'Support module for user language testing.'
        package: Testing
        version: VERSION
        user_language_test.post_response:
        path: '/user-language-test/post'
        defaults:
        _controller: Drupal\user_language_test\Controller\UserLanguageTestController::buildPostResponse
        methods: [post]
        options:
        _admin_route: TRUE
        requirements:
        _access: 'TRUE'
        user_language_test.form:
        path: '/user-language-test/form'
        defaults:
        _form: 'Drupal\user_language_test\Form\UserLanguageTestForm'
        requirements:
        _access: 'TRUE'
        ......@@ -31,7 +31,7 @@ class UserAdminLanguageTest extends BrowserTestBase {
        *
        * @var array
        */
        protected static $modules = ['user', 'language', 'language_test'];
        protected static $modules = ['user', 'language', 'language_test', 'user_language_test'];
        /**
        * {@inheritdoc}
        ......@@ -156,6 +156,13 @@ public function testActualNegotiation() {
        $this->drupalGet('xx/' . $path);
        $this->assertSession()->pageTextContains('Language negotiation method: language-user-admin');
        // Make sure 'language-user-admin' plugin does not fail when a route is
        // restricted to POST requests and language negotiation with the admin
        // language method is used.
        $this->drupalGet('/user-language-test/form');
        $this->submitForm([], 'Send');
        $this->assertSession()->statusCodeEquals(200);
        // Unset the preferred language code for the user.
        $edit = [];
        $edit['preferred_admin_langcode'] = '';
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment