[Zope-CMF] Newbie query 2 - Add Permissions for CMF Content
Wankyu Choi
Wankyu Choi <wankyu@neoqst.com>
9 Oct 2002 16:52:00 -0000
Thanks! Could you take two more stupid questions?^^
1. Can I add two distinct groups of content objects? One for ordinary members the other for reviewers and above.. sort of:
utils.ContentInit( 'Normal Content'
, content_types=contentClasses
, permission=AddPortalContent
, extra_constructors=contentConstructors
, fti=Portal.factory_type_information
).initialize( context )
utils.ContentInit( 'Advanced Content'
, content_types=contentClasses
, permission=AddAdvancedPortalContent
, extra_constructors=contentConstructors
, fti=Portal.factory_type_information
).initialize( context )
Tried it and miserably failed. Only the first ContentInit call works. Should I separate them into separate products?
2. I have an article product that needs to be CMF'ied. It's a folderish object that could hold multiple pages (documents, thus automagically creating a list of navigation links to each page), images, tables, forms, etc. In ZMI, I can manage to make these article elements disappear in the Add list under a normal folder (extended one with all_meta_types tweaked to that effect) and appear only in this folderish article object. How can I achieve the same effect in CMF? Say, a table element instance doesn't have any meaning (at least in my product) outside of this article object. That is, it shouldn't appear in the selection list unless you're in an article folder. Only the article object should appear in the selection list with article elements appearing only in an article instance.
(I just began to get my hands dirty in CMF and find it real fun.)
Best Regards,
Wankyu Choi
-----Original Message-----
From: Tres Seaver [mailto:tseaver@zope.com]
Sent: Wednesday, October 09, 2002 9:24 PM
To: Wankyu Choi
Cc: zope-cmf@zope.org
Subject: Re: [Zope-CMF] Newbie query - Add Permissions for CMF Content
On Wed, 2002-10-09 at 08:08, Wankyu Choi wrote:
> I'm fairly new to CMF, so this might be a very stupid and/or basic question,
> but...
>
> How could I disallow members to add a particluar content object?
Protect its factory with a permission you don't grant to the "Member"
role.
> For example, I added a portal type named "Advanced Document" that can do
> DTML. (It's part of a filesystem-based portal product that extends
> CMFDefault/Plone and gets promatically added when this product creates
> a portal, much like what Plone does.) And I don't want ordinary
> members to even view this object in the selection list.
Good plan; dynamic content is *dangerous*. :)
> That is, only those with manager/reviewer roles are supposed to add
> this particular content at will.
>
> How do I go about it?
When you register the class as addable, supply a permission besides
"Add portal content" (which is what all the CMFDefault content types
declare). CMFDefault.__init__.initialize has::
utils.ContentInit( 'CMFDefault Content'
, content_types=contentClasses
, permission=AddPortalContent
, extra_constructors=contentConstructors
, fti=Portal.factory_type_information
).initialize( context )
You would supply a different permission.
Tres.
--
===============================================================
Tres Seaver tseaver@zope.com
Zope Corporation "Zope Dealers" http://www.zope.com