"Cornelis J. de Brabander" <brabander@fsw.leidenuniv.nl> wrote:
To: "zope" <zope@zope.org> Subject: [Zope] user created folders and local owner role problem in 2.1.3 Date: Thu, 17 Feb 2000 11:04:02 +0100 charset="iso-8859-1"
Silence was my part after an ealier effort, so I'll give it another try. I have a application for web supported learning, basically a platform where teachers and students can exchange information. It runs in zope 2.0.0. Users may create documents or folders by means of a dtml-method that wraps manage_clone. In version 2.0.0 the user automatically acquires a local role of owner in the context the folder or document involved. When I was upgrading to zope version 2.1.3 I noticed this automatisme did not apply anymore to folders, but only to documents: users are not given the local owner role in he context of a folder they create. Bug or feature? It is a problem, because what users ar permitted to do depends to a certain extent on ownership. Please help me out. tia, cb
Ok, from the horse's mouth ("Trust the source, Luke!"): [/home/tres/Zope2/lib/python/OFS] $ \ cvs diff -u -r Zope-2_0_0-src -r Zope-2_1_3-src ObjectManager.py Index: ObjectManager.py =================================================================== RCS file: /cvs-repository/Zope2/lib/python/OFS/ObjectManager.py,v retrieving revision 1.80 retrieving revision 1.82 diff -u -r1.80 -r1.82 --- ObjectManager.py 1999/07/22 19:19:22 1.80 +++ ObjectManager.py 1999/11/04 19:34:20 1.82 @@ -84,9 +84,9 @@ ############################################################################## __doc__="""Object Manager -$Id: ObjectManager.py,v 1.80 1999/07/22 19:19:22 jim Exp $""" +$Id: ObjectManager.py,v 1.82 1999/11/04 19:34:20 brian Exp $""" -__version__='$Revision: 1.80 $'[11:-2] +__version__='$Revision: 1.82 $'[11:-2] import App.Management, Acquisition, App.Undo, Globals, CopySupport, Products import os, App.FactoryDispatcher, ts_regex, Products @@ -230,12 +230,15 @@ self._setOb(id,object) object=self._getOb(id) object.manage_afterAdd(object, self) - # Try to give user the local role "Owner". + + # Try to give user the local role "Owner", but only if + # no local roles have been set on the object yet. if hasattr(self, 'REQUEST') and hasattr(object, '__ac_local_roles__'): - user=self.REQUEST['AUTHENTICATED_USER'] - name=user.getUserName() - if name != 'Anonymous User': - object.manage_setLocalRoles(name, ['Owner']) + if object.__ac_local_roles__ is None: + user=self.REQUEST['AUTHENTICATED_USER'] + name=user.getUserName() + if name != 'Anonymous User': + object.manage_setLocalRoles(name, ['Owner']) return id def manage_afterAdd(self, item, container): @@ -526,8 +529,7 @@ mtime=self.bobobase_modification_time().timeTime() # get owner and group owner=group='Zope' - for r in self.get_local_roles(): - user,roles=r + for user, roles in self.get_local_roles(): if 'Owner' in roles: owner=user break At a guess, the folder that you clone has local roles attached? I think you would be best off to just force the ownership yourself after the clone: <dtml-let username="AUTHENTICATED_USER.getUserName()"> <dtml-call "manage_setLocalRoles( username, [ 'Owner' ] )"> </dtml-let> -- ========================================================= Tres Seaver tseaver@palladion.com 713-523-6582 Palladion Software http://www.palladion.com