Problem/Motivation
On a fresh installation of Drupal 8, go to admin/structure/block/demo/seven as an unprivileged/anonymous user. The "access denied" page you get to is shown in the Seven theme, rather than Bartik.
This is incorrect since the unprivileged user does not have permission to see the administrative theme. The access denied page should be shown to them in Bartik, like on other admin pages.
Proposed resolution
Add a permission check to AdminDemoNegotiator.
Remaining tasks
Needs review.
User interface changes
The theme specified in the route is no longer shown to unprivileged users.
API changes
The current user is passed to the theme negotiator.
Data model changes
None.
Comments
Comment #1
David_Rothstein commentedDrupal 7 does not have this issue, but has a related issue instead.
Comment #2
MattA commentedFor testing.
Comment #3
MattA commentedEdited IS to use template.
Comment #4
mr.baileysPatch with test attached.
Comment #6
mr.baileysComment #7
MattA commentedAdminDemoNegotiatorneeds to know if the user has permission to see all of them (which is strongly implied when a user is granted 'administer blocks').Comment #9
MattA commentedComment #22
tintoThe patch no longer applies against Drupal 9.4.x, as it targets
core/modules/block/src/Tests/BlockAdminThemeTest.php.However, the location of this file is now:
/core/modules/block/tests/src/Functional/BlockAdminThemeTest.phpChanging the status of this issue to 'Needs work'.
Comment #23
ankithashettyHere is the rerolled patch. As suggested in #22, made changes to the new file
/core/modules/block/tests/src/Functional/BlockAdminThemeTest.php. Also, removed the deprecated line$this->assertRaw('core/themes/classy');and replaced it with$this->assertSession()->responseContains('core/themes/classy');.Thanks!
Comment #25
abhijith s commentedApplied patch #23 on 9.5.x.The patch fixes the issue.The non admin theme will be shown after applying this patch for anonymous users in the
admin/structure/block/demo/sevenpage.RTBC +1
Comment #26
abhijith s commentedComment #27
abhijith s commentedSorry, I've uploaded wrong screenshots.Please find the actual screenshots before and after applying patches.
Before patch:

After patch:
