[Zope-CMF] Setting default local permissions in a Python product?
Florent Guillaume
fg@nuxeo.com
Wed, 22 May 2002 15:01:18 +0000 (UTC)
You need to use manage_permissions.
At the place where your newly created object is put into the ZODB,
usually in the addMyProduct or manage_addMyProduct method, do something
like the following (using Document as an example):
def addDocument(self, id, title='', description='', text_format='',
text=''):
""" Add a Document """
o = Document(id, title, description, text_format, text)
self._setObject(id,o)
o = self._getOb(id) # get a wrapped object
o.manage_permissions('View', ['Manager'], acquire=0)
o.manage_permissions('Access contents information', ['Manager'],
acquire=0)
Florent
Jon Edwards <jon@pcgs.freeserve.co.uk> wrote:
> Hi all, please excuse me if this is obvious, but I'm having a "dumb day"!
>
> Can anyone point me at some example code that will show me the "right way"
> to set the default local permissions for a python product (CMF) I'm making,
> based on Portal Folder?
>
> Two examples -
>
> - Workgroup-Folder - whenever one of these is added, it should turn off the
> automatically-inherited permissions for Portal Members to View and Access
> Content Info (even if it's published) - so that only locally-assigned people
> have access to its contents.
>
> - Discussion-Folder - should (by default) allow Anonymous to create
> "Discussion Items" (which I'll sub-class from Document) and replies.
>
> I've scanned through CMFDefault, etc, but couldn't find an example of how to
> do this in a product/module
>
> Cheers, Jon
--
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87 http://nuxeo.com mailto:fg@nuxeo.com