[Zope-CMF] allowedContentTypes

Florent Guillaume fg@nuxeo.com
Fri, 13 Sep 2002 22:45:26 +0000 (UTC)


Kevin Carlson <khcarlso@bellsouth.net> wrote:
> I am using the allowedContentTypes method to retrieve the, you guessed it,
> allowed content types for a folder.  The problem I am having is that when an
> anonymous user calls this function, it returns nothing.  I have checked the
> portal_types tool and all is set up correctly (filter types on, numerous
> types selected).
> 
> The reason that an anonymous user needs to call this is so that I can allow
> search results to be narrowed by document type.  I am doing the following:
> 
> <dtml-in allowedContentTypes>
> ...
> </dtml-in>
> 
> This returns nothing.  I have tried giving the dtml method a proxy role of
> Manager but that does not work.  When I try to set the proxy role to Member,
> I get the following error message:
> 
>    You are not authorized to change [method] because you do not have proxy
> roles.
> 
> I haven't seen that before.  Is my first problem related to the second? If
> not, can anyone offer an explanation / solution to either problem?

allowedContentTypes is a method of the current folder, which checks
which types are allowed for construction, for the current user, in the
given folder. As the docstring of allowedContentTypes says, """List type
info objects for types which can be added in this folder."""

If what you want is to list all the content types viewable by the
current user in the portal, use portal_types.listTypeInfo().

If you want a different definition for "allowed document types in this
context" then that's a restriction imposed by your application, and
you'll have to provide your own methods to do the filtering.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com