[Zope-CMF] Newbie query - Add Permissions for CMF Content

Tres Seaver tseaver@zope.com
09 Oct 2002 08:24:28 -0400


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