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
Review
User interface changes
None.
Introduced terminology
None.
API changes
None.
Data model changes
None.
Release notes snippet
Minor change only.
Issue fork drupal-3470876
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3470876-term-view-access-before-redirect
changes, plain diff MR !9365
Comments
Comment #3
dpiComment #4
dpiTest fail seems unrelated...
Comment #6
acbramley commentedOne failure was related, the other didn't seem it.
Comment #7
dpiJust the unrelated Nightwatch failure now.
Comment #8
smustgrave commentedRan test-only feature and test coverage appears to be there.
There was a reported nightwatch failure in HEAD and believe that's it.
Issue summary appears complete and looking at the code review don't see anything off.
LGTM
Comment #9
catchMR looks fine but I think we should have a follow-up to apply the same pattern across entity types - users, media etc. I looked for an existing issue to unify these but couldn't find it, pretty sure we have one though.
Comment #10
catchFound it, opened by me 16 years ago... #239715: UMN Usability: Where do forms redirect to?.
Comment #11
catchCommitted/pushed to 11.x, thanks!