Check term view access before trying to redirect after an update

Created on 29 August 2024, 4 months ago

Problem/Motivation

When a user is editing a term, then saves the form, Drupal will send the user to the term view form.

However Drupal doesn't know if the user has access to view the form. There may be custom code, such as entityaccess hooks (in my case), that change behaviour. If custom behaviour disallows view access, the user will see a access denied page.

Steps to reproduce

Proposed resolution

Check whether the user has access to view a term before trying to redirect them.

If the user does not have access, do not add a redirect. This in effect simply refreshes the update form, which we know the user has access to.

Node has had similar behaviour for over 10 years now ( #1429442: Access denied page shown after submitting form that creates a unpublished node β†’ ), wherin it checks if a user can view a node, before trying to redirect them.

Remaining tasks

Add tests.

User interface changes

None.

Introduced terminology

None.

API changes

None.

Data model changes

None.

Release notes snippet

Minor change only.

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component
TaxonomyΒ  β†’

Last updated 2 days ago

  • Maintained by
  • πŸ‡ΊπŸ‡ΈUnited States @xjm
  • πŸ‡¬πŸ‡§United Kingdom @catch
Created by

πŸ‡¦πŸ‡ΊAustralia dpi Perth, Australia

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024