Incorrect access denied messages in branding block

Created on 15 February 2017, almost 8 years ago
Updated 11 April 2023, over 1 year ago

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

  1. Add a new user and assign a role other than administrator say Content Editor (comes default with Drupal 10)
  2. Login with the newly created user and go to /admin/structure/block
  3. From the admin permissions page /admin/people/permissions, give permission to "Administer blocks" for the "Content Editor"
  4. Configure Site Branding block /admin/structure/block/manage/olivero_site_branding to see the results in "Toggle branding elements
    " section
🐛 Bug report
Status

Needs work

Version

10.1

Component
System 

Last updated 4 days ago

No maintainer
Created by

🇦🇺Australia dpi Perth, Australia

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.

  • Status changed to Needs review over 1 year ago
  • 🇺🇸United States smustgrave

    Rerolled #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

  • 🇮🇳India TanujJain-TJ

    tested 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

  • Status changed to RTBC over 1 year ago
  • 🇮🇳India saket-001

    patch #38 is working fine. also mentioned in #39 so moving status to RTBC.

  • Status changed to Needs work over 1 year ago
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
    +++ b/core/modules/block/tests/src/Functional/BlockSystemBrandingTest.php
    @@ -115,6 +115,17 @@ public function testSystemBrandingSettings() {
    +    $this->assertSession()->responseNotContains('Defined on the Appearance or Theme Settings page. You do not have the appropriate permissions to change the site logo.');
    +    $this->assertSession()->responseNotContains('Defined on the Site Information page. You do not have the appropriate permissions to change the site logo.');
    +    $this->assertSession()->responseNotContains('Defined on the Site Information page. You do not have the appropriate permissions to change the site logo.');
    

    We 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

  • 🇮🇳India Akram Khan Cuttack, Odisha

    added updated patch and addressed #41

Production build 0.71.5 2024