[Zope-CMF] limiting types to add by role

Dieter Maurer dieter@handshake.de
Wed, 28 Aug 2002 22:14:25 +0200


Kelley, Sean writes:
 > I want to limit the list of addable content types by role.
A content type is only addable in a folder when the user has
the corresponding permission in the folder.

By default, all content types are protected by the same permission
(this is set up by the "ContentInit" in "__init__.py").

When you call "ContentInit" several times for the various parts of the content
types, you can protect their creation with different permissions.

Apparently, there is some cludge: "contentInit" must always be called
with the same "factory_type_information" object as later calls
overwrite the one registered with former calls.

For me, it looks like

    utils.ContentInit( 'WebCMS Inhalte'
                     , content_types=WebCMSClasses
                     , permission=EditHaufeContent
                     , extra_constructors=WebCMSConstructors
                     , fti=Portal.factory_type_information
                     ).initialize( context )

    utils.ContentInit( 'Member Inhalte'
                     , content_types=MemberContentClasses
                     , permission=AddPortalContent
                     , extra_constructors=MemberContentConstructors
                     , fti=Portal.factory_type_information
                     ).initialize( context )


Dieter