From 2e49bace5416a734d71b80e120a1aa2f7e3b738b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= Date: Wed, 24 Apr 2024 14:43:58 +0900 Subject: [PATCH] Fix authentication error viewing ZMI resource with virtual hosting (#1204) * ZMI: re-implement the logic to prepend authentication path The previous approach from #1196 was not correct when using virtual host, because AUTHENTICATION_PATH is not usable in virtual host contexts. This uses a different approach, by making the js and css path subscribers take care of generating the URLs with the authentication path prepended using request API aware of virtual hosting. * ZMI: use /++resource++logo/ for public resources /++resource++zmi/logo/ and /++resource++logo/ is the same folder on disk, the former is protected by Manage portal and the later is public. Protected resources were problematic, because we want to serve them from the root, but the manager user might not have permission on the root. * ZMI: include zmi.localstorage.api.js using js subscriber Using this approach we serve a resource relative to the path where user is authenticated. * copyright.dtml: update bootstrap URL This was referencing an old URL. Co-authored-by: Maurits van Rees --- CHANGES.rst | 3 +- src/App/dtml/copyright.dtml | 16 +-- src/App/dtml/manage.dtml | 14 +-- src/App/dtml/manage_page_header.dtml | 20 ++-- src/App/dtml/menu.dtml | 1 - .../resources/logo/favicon/browserconfig.xml | 8 +- .../resources/logo/favicon/site.webmanifest | 4 +- src/zmi/styles/subscriber.py | 54 ++++++++-- src/zmi/styles/tests.py | 101 ++++++++++++++++-- 9 files changed, 173 insertions(+), 48 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 4bc40ca282..edac84affb 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -30,7 +30,8 @@ https://github.com/zopefoundation/Zope/blob/4.x/CHANGES.rst Fixes `#1077 `_. - Fix authentication error viewing ZMI with a user defined outside of zope root. - Fixes `#1195 `_. + Fixes `#1195 `_ and + `#1203 `_. - Work around ``Products.CMFCore`` and ``Products.CMFPlone`` design bug (registering non callable constructors). diff --git a/src/App/dtml/copyright.dtml b/src/App/dtml/copyright.dtml index 7b1d544f08..6843c58d45 100644 --- a/src/App/dtml/copyright.dtml +++ b/src/App/dtml/copyright.dtml @@ -6,16 +6,16 @@ Zope Public License (ZPL) Version 2.1 - + - - - - - - - + + + + + + + diff --git a/src/App/dtml/manage.dtml b/src/App/dtml/manage.dtml index 89800b76bc..1d6f237f2c 100644 --- a/src/App/dtml/manage.dtml +++ b/src/App/dtml/manage.dtml @@ -2,13 +2,13 @@ Zope on &dtml-BASE0; - - - - - - - + + + + + + + diff --git a/src/App/dtml/manage_page_header.dtml b/src/App/dtml/manage_page_header.dtml index e8b8659e10..a70451a9c3 100644 --- a/src/App/dtml/manage_page_header.dtml +++ b/src/App/dtml/manage_page_header.dtml @@ -10,27 +10,25 @@ <dtml-if title_or_id><dtml-var title_or_id><dtml-else>Zope</dtml-if> - - + - + - - - - - - - + + + + + + + - " class="zmi zmi- zmi-"> diff --git a/src/App/dtml/menu.dtml b/src/App/dtml/menu.dtml index a23800fd28..548c1c5185 100644 --- a/src/App/dtml/menu.dtml +++ b/src/App/dtml/menu.dtml @@ -64,7 +64,6 @@ -