[Zope-CMF] Registering content types with different add
permissions in one module
Dieter Maurer
dieter at handshake.de
Tue Oct 21 17:05:31 EDT 2003
Heimo Laukkanen wrote at 2003-10-21 15:51 +0300:
> I need to register new types into Portal, but would need different add
> permissions for different types. I have all my content types created
> with Archetypes in content.py, which is in MyProject directory.
>
> How can I register some of these types with one permission and rest of
> them with another? I tried to do second ContentInit.initialize call with
> just a few of the types - but it wiped out types that I registered
> beforehand.
>
> There must be some solution?
>
> def initialize(context):
> import content
> content_types, constructors, ftis = process_types(
> listTypes(PROJECTNAME),
> PROJECTNAME)
> utils.ContentInit(
> PROJECTNAME + ' Content',
> content_types = content_types,
> permission = ADD_CONTENT_PERMISSION,
> extra_constructors = constructors,
> fti = ftis,
> ).initialize(context)
We use separate "ContentInit" for the sets that require
different permissions, e.g.:
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 )
Someone reported that there are restriction for this approach.
When I remember right (--> mailing list archives, to be sure),
then the "fti" must be identical as otherwise the last "fti" wins.
Dieter
More information about the Zope-CMF
mailing list