[Zope-CMF] CMFStaging LockTool + CMFDefault Document

Dan Axline waxline@dsndata.com
Sat, 05 Jul 2003 20:40:48 -0500


I ended up changing failIfLocked().  This solves my immediate problem,
but I'm not sure it's really the right way.  Comments, suggestions
welcome.

--- PortalContent.py~   Sun Feb  2 21:44:03 2003
+++ PortalContent.py    Sat Jul  5 19:38:20 2003
@@ -21,7 +21,7 @@
  from Globals import InitializeClass
  from Acquisition import aq_base
  from OFS.SimpleItem import SimpleItem
-from AccessControl import ClassSecurityInfo
+from AccessControl import ClassSecurityInfo, getSecurityManager

  from CMFCorePermissions import AccessContentsInformation, View, FTPAccess

@@ -43,7 +43,6 @@
  except ImportError:
      NoWL = 1

-
  class PortalContent(DynamicType, CMFCatalogAware, SimpleItem):
      """
          Base class for portal objects.
@@ -93,7 +92,15 @@
          Check if isLocked via webDav
          """
          if self.wl_isLocked():
-            raise ResourceLockedError, 'This resource is locked via webDAV'
+            values = self.wl_lockValues()
+            if not values:
+                raise ResourceLockedError, 'Error examining webDAV lock.'
+
+            creator = values[0].getCreator()
+            uid = getSecurityManager().getUser().getId()
+            if creator[1] != uid:
+                raise ResourceLockedError, 'This resource is locked via webDAV'
+
          return 0


Dan Axline wrote:
> When I do a context.edit() (from the document_edit script) on locked 
> Document, I get the error message "This resource is locked via webDAV". 
>  I am not allowed to edit the document even though I am the one who 
> locked it.
> 
> Looking at the source, I see this is because the edit method calls 
> failIfLocked().
> 
> What is the recommended way of getting around this?  It kinda looks like 
> I'll have to edit the source, but I'm hoping not...  I'd rather not have 
> to keep track of patches.
> 
> If editing the source is the answer, I'm guessing failIfLocked() is the 
> method to modify since DublinCore.py also uses this.  Otherwise I would 
> have to change both Document.py and DublinCore.py.
> 
> Perhaps I am missing something?
> 
> - Daniel
> 
> 
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@zope.org
> http://mail.zope.org/mailman/listinfo/zope-cmf
> 
> See http://collector.zope.org/CMF for bug reports and feature requests
>