Problem/Motivation
Error description refers to incorrect element
when a user does not have permission to edit the site name or slogan, an incorrect access denied message is displayed: "Defined on the Site Information page. You do not have the appropriate permissions to change the site logo." it refers to "site logo".

Error refers to pages the user does not have access
When a user does not have permission to do something, we don't usually have an explanation message.
I'd like to propose removing the "You do not have the appropriate permissions to change the ...." message. I have a client that became confused why he was not granted permission to do something, despite being so close to being able to do it.
And remove the "Defined on the XXX page." text if the user does not have permission to access it.
Steps to reproduce
- Add a new user and assign a role other than administrator say Content Editor (comes default with Drupal 10)
- Login with the newly created user and go to /admin/structure/block
- From the admin permissions page /admin/people/permissions, give permission to "Administer blocks" for the "Content Editor"
- Configure Site Branding block /admin/structure/block/manage/olivero_site_branding to see the results in "Toggle branding elements
" section
Proposed resolution
Remaining tasks
User interface changes
Refer to images in #47
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #47 | after-patch-claro.png | 100.48 KB | sd9121 |
| #47 | before-patch-claro.png | 106.64 KB | sd9121 |
| #47 | after-patch-olivero.png | 89.72 KB | sd9121 |
| #47 | before-patch-olivero.png | 115.27 KB | sd9121 |
Issue fork drupal-2852838
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:
Comments
Comment #2
dpiComment #4
dpiFixed PHP5 error
Comment #5
bander2 commentedThe patch is not applying to 8.4.x-dev. Looks like it's using the long array syntax and drupal now uses the short syntax.
Comment #6
jofitzRe-rolled.
Comment #7
bander2 commentedAwesome! I'm attaching screenshots of the new branding elements section of the branding block for reverence:
With permissions to administer theme and configuration:

Without permissions to administer theme and configuration:

Comment #8
wim leersThis is a string change!
These can be merged:
Url::fromRoute()takes route parameters too.Comment #9
jofitzUrl::fromRoute().Comment #17
ranjith_kumar_k_u commentedThe last patch applied cleanly on 9.2 these are the changes for a user without permissions.

Before patch
After patch
Comment #21
borisson_Moving this back to rtbc, the change here is still a good thing to do and the technical remark by @Wim Leers in #8 has been resolved.
Comment #22
quietone commentedThe latest patch here, in #9 does not apply to 9.5.x.
Un-assigning because dpi has not working on this for 5 years.
Comment #23
mrinalini9 commentedRerolled patch #9 for the 9.5.x branch, please review it.
Comment #24
asha nair commentedpatch #23 was applied successfully in 9.5.x branch. Adding screenshots for reference
Comment #25
smustgrave commentedPatch looks good just needs tests.
Comment #26
smustgrave commentedTake that back admin users blocks are now throwing fatal errors. Users with right role get warning. SO patch needs work.
Comment #27
smustgrave commentedComment #30
smustgrave commentedComment #31
deepalij commentedComment #33
kristen polUnassigning given the delay and also since we don't normally assign Drupal core issues to ourselves.
Comment #34
gaurav-mathur commentedIssue already resolve in version 10. Adding screenshot for reference.
Comment #35
sonam.chaturvedi commentedThis issue is still reproducible on 10.1 for Olivero / Bartik themes Site branding blocks.
Please see attached screenshot.
Verified patch#27 on 10.1.x-dev. Patch do not apply, may be due test failure. This needs work.
Comment #36
prashant.cThis issue also exists in 10.0.2-dev for the default themes Olivero and Claro.
Adding steps to reproduce in the main description.
Comment #38
smustgrave commentedRerolled #27
error: patch failed: core/modules/block/tests/src/Functional/BlockSystemBrandingTest.php:119
error: core/modules/block/tests/src/Functional/BlockSystemBrandingTest.php: patch does not apply
Comment #39
tanuj. commentedtested and verified patch #38 on claro and olivero themes, patch applied successfully and fixed the 'Incorrect access denied messages in branding block', attaching screenshots for reference. need RTBC+1
Comment #40
skt-001 commentedpatch #38 is working fine. also mentioned in #39 so moving status to RTBC.
Comment #41
larowlanWe never emit 'You do not have the appropriate permissions' anymore, so these assertions would still pass even if the patch didn't work.
Let's change them to assert the new string isn't emitted.
Let's also add some positive asserts for the user that does have the required permissions
Comment #42
akram khanadded updated patch and addressed #41
Comment #46
mstrelan commentedApplied the latest patch and converted to a merge request. Fixed the test coverage and found a bug with the active theme and fixed that too.
Comment #47
sd9121 commentedI have reviewed and tested the patch against Drupal 11.x-dev, and it works as expected. The patch successfully removes the incorrect access denied messages that appeared in the Site Branding block when users lacked permission to edit certain elements. Specifically, users without the appropriate permissions no longer see misleading references such as "You do not have the appropriate permissions to change the site logo" when they only lack access to the site name or slogan.
Comment #48
quietone commentedThis is changing the User Interface, so adding tag. I have also updated credit.
A reminder to everyone making screenshots that they should be available from the Issue Summary. Doing so makes it much easier for reviewers and committers.
Comment #49
quietone commentedComment #50
longwaveI manually tested this but there is a bug, the "Theme Settings" link does not always take me to the right place.
Comment #51
longwaveThis is probably out of scope and requires a new issue, but for users with permission, should we just allow them to configure these settings directly from the block?
Comment #53
pameeela commentedFound this issue while working with Canvas, I followed the link to the Appearance settings to change the logo, and I thought there was a bug when it didn't update. Took me a few minutes to figure out that I changed the global logo rather than the one for my default theme.
I think the current state of the MR makes it more confusing by providing two different links (one of which is often to the admin theme rather than the front end theme).
Can we link only to the default front end theme page? What is the purpose of the global logo settings anyway?