Re: Bugfix for manage_dtpref in ZMS 2.11 (was: Bad problem with ZMI Sitemap in ZMS 2.11.0)

Gregor Hoffleit <[email protected]>
Newsgroups gmane.comp.cms.zms.devel
Message-ID <[email protected]>
And here comes the patch file.

Regards,
    Gregor Hoffleit


* Gregor Hoffleit <[email protected]> [080508 14:00]:
> Dear Mr. Hoffmann,
> 
> attached is a suggested bugfix for zmsobject.py and ZMSItem.py (patch
> based on ZMS 2.11.0-09_4).
> 
> Obviously during the transition of the ZMS object model in 2.11, the
> method manage_dtpref() was overlooked. As far as I can see,
> manage_dtpref() should be moved from ZMSObject into ZMSItem as well.
> 
> This patch fixes the problem with the ZMS Sitemap that I reported a week
> ago (see below). The problem behind my observation was that non-admin
> ZMS users were not allowed to use manage_dtpref, so they failed to
> switch any preference in the management interface (like e.g. the
> sitemap).
> 
> Please consider this fix for inclusion in 2.11.0.
> 
> Regards,
>     Gregor Hoffleit
> 
> 
> * Gregor Hoffleit <[email protected]> [080430 12:26]:
> > I running into a strange and bad behavior with ZMS 2.11.0:
> > 
> > When I try to enable the left navigation tree frame in the ZMS
> > management interface ('Sitemap' button at the right top), I'm kicked out
> > of the Zope/ZMS session!
> > 
> > I.e. the browser requests a username and password for the realm 'Zope',
> > invalidating my existing session.
> > 
> > 
> > To reproduce, create a new ZMS instance. In the ZMS instance, create a
> > user "autor" with (only!) the "Autor" role in the ZMS Home. Log out of
> > ZMS. (Perhaps you should close all browser windows and empty your
> > browsers cache for cookies etc., if you can't reproduce the following.)
> > Open the public homepage of the ZMS instance and log into ZMS as
> > "autor". Click on the "Sitemap" icon at the right top. Ooops: The
> > browser asks for username and password for 'Zope', and the ZMS session
> > is invalidated.
> > 
> > 
> > This happens e.g. with ZMS 2.11.0-09_3 (running on Zope 2.10.5 on Debian
> > 4.0). I haven't seen this problem with ZMS 2.10.x.
> > 
> > The behavior seems to vary on different browser systems, but I was able
> > to reproduce the problem with Safari and Firefox on OSX and Firefox on
> > Linux. It also affects MSIE and Firefox on Windows.
> 
> 
> -- 
> Gregor Hoffleit <[email protected]>
> Media Supervision Software Consulting GmbH
> Georg-Friedrich-Haendel-Str. 13, 69214 Eppelheim/Heidelberg
> Tel: +49 6221 705079-0  /  Fax: +49 6221 705079-80
> Amtsgericht Mannheim, HRB 336821, Geschäftsführer Reinhard Kratzke
> http://www.mediasupervision.de/


-- 
Gregor Hoffleit <[email protected]>
Media Supervision Software Consulting GmbH
Georg-Friedrich-Haendel-Str. 13, 69214 Eppelheim/Heidelberg
Tel: +49 6221 705079-0  /  Fax: +49 6221 705079-80
Amtsgericht Mannheim, HRB 336821, Geschäftsführer Reinhard Kratzke
http://www.mediasupervision.de/
manage_dtpreff.diff (text/x-diff, 2.9 KB)
--- /tmp/zms/zmsobject.py	2008-05-08 13:39:06.000000000 +0200
+++ zmsobject.py	2008-05-08 13:37:07.000000000 +0200
@@ -24,7 +24,6 @@
 # Imports.
 from __future__ import nested_scopes
 from Globals import HTMLFile
-from DateTime.DateTime import DateTime
 from types import StringTypes
 import ZPublisher.HTTPRequest
 import urllib
@@ -1050,29 +1049,6 @@
     """
     ############################################################################
     ###  
-    ###  Sitemap
-    ### 
-    ############################################################################
-    """
-
-    ############################################################################
-    #  ZMSObject.manage_dtpref: 
-    #
-    #  De-/Activate Document-Template preference.
-    ############################################################################
-    def manage_dtpref(self, key, lang, REQUEST, RESPONSE):
-      """ ZMSObject.manage_dtpref """
-      v = 1
-      if REQUEST.has_key(key):
-        v = int(not string.atoi(REQUEST[key]))
-      e=(DateTime('GMT')+365).rfc822()
-      RESPONSE.setCookie(key,str(v),path='/',expires=e)
-      return RESPONSE.redirect('manage?lang=%s'%lang)
-
-
-    """
-    ############################################################################
-    ###  
     ###  DOM-Methoden 
     ### 
     ############################################################################
--- /tmp/zms/ZMSItem.py	2008-05-08 13:39:06.000000000 +0200
+++ ZMSItem.py	2008-05-08 13:30:54.000000000 +0200
@@ -24,10 +24,12 @@
 # Imports.
 from __future__ import nested_scopes
 from Globals import HTMLFile, Persistent
+from DateTime.DateTime import DateTime
 from Acquisition import Implicit
 from OFS.PropertySheets import PropertySheets, vps
 from webdav.Lockable import ResourceLockedError
 import OFS.SimpleItem, OFS.ObjectManager, webdav.Collection
+import string
 # Product Imports.
 import _webdav
 
@@ -110,6 +112,29 @@
     """
     ############################################################################
     #
+    #   Sitemap
+    #
+    ############################################################################
+    """
+
+    # --------------------------------------------------------------------------
+    #  ZMSItem.manage_dtpref: 
+    #
+    #  De-/Activate Document-Template preference.
+    # --------------------------------------------------------------------------
+    def manage_dtpref(self, key, lang, REQUEST, RESPONSE):
+      """ ZMSObject.manage_dtpref """
+      v = 1
+      if REQUEST.has_key(key):
+        v = int(not string.atoi(REQUEST[key]))
+      e=(DateTime('GMT')+365).rfc822()
+      RESPONSE.setCookie(key,str(v),path='/',expires=e)
+      return RESPONSE.redirect('manage?lang=%s'%lang)
+
+
+    """
+    ############################################################################
+    #
     #   WebDAV
     #
     ############################################################################
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.