Implement admin fallback redirect

Created on 29 March 2022, over 2 years ago
Updated 9 March 2023, over 1 year ago

Problem/Motivation

There are scenarios when a user has access to a certain page which is not a custom element and instead of being redirected to it 404 is returned. E.g: multi-language is enabled and admin paths for editing a node contain the langcode, /en/node/{node_id}/edit, when the user tries to visit the page, because it is not a custom elements page, module recognizes it as 404.

Proposed resolution

Every time someone accesses the API of a route which the user has access to but has no custom-element equivalent we would add a "fallback redirect" only for admin (via permission) to implement a clean admin-fallback redirect.

Feature request
Status

Fixed

Version

2.2

Component

Code

Created by

🇷🇴Romania ciprian.stavovei

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇦🇹Austria fago Vienna

    We cannot do this here, since lupus_ce_renderer does not know about the frontend URL. So moving to lupus_decoupled.

    so CustomElementsViewSubscriber has that event:

    $events[KernelEvents::VIEW][] = ['onKernelView', 100];

    where it detects this situation:

    // Custom elements requested, but the route does not handle it.
    $event->setResponse(new Response('Route does not render into custom elements.', Response::HTTP_NOT_IMPLEMENTED));

    in which case we can issue a redirect

  • 🇦🇹Austria fago Vienna
  • Status changed to Needs review over 1 year ago
  • 🇦🇹Austria fago Vienna

    ok, when implementing I figured we don't need to know the frontend base URL, so we can just implement this from lupus_ce_renderer, what makes it much easier. so back to it.

    it seems to work as a charm. logged out respones for /admin or /node/x/edit are served as normal 403, when logged-in a redirect response is served. as a result local-tasks work like a charme, e.g. you end up e.g. at https://lupus-decoupled.ddev.site/node/1/revisions when clicking on the revisions tab

  • Status changed to RTBC over 1 year ago
  • 🇦🇹Austria arthur_lorenz Vienna

    Tested on a fresh ddev installation. Works as expected!

    • fago committed d2af6dca on 2.x
      Issue #3272161 by fago, arthur_lorenz: Implement admin fallback redirect
      
  • Status changed to Fixed over 1 year ago
  • 🇦🇹Austria fago Vienna

    thanks! also regression tests on a project were fine, so merging.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024