[Zope-CMF] Re: Content types per role
schubbe at web.de
Fri Dec 19 05:45:54 EST 2003
Seb Bacon wrote:
> Yuppie wrote:
>> Seb Bacon wrote:
>>> Yuppie wrote:
>>>> AFAICT the easiest way to implement this is hooking into the
>>>> existing cookie-based machinery for switching skins: The list of
>>>> selectable skins could be controlled by roles and members could get
>>>> an initial portal_skin property based on the assigned roles.
>>> This is what I did, but the problem is that you're not authenticated
>>> at traversal hook time, so there's no way of knowing your role.
>> Seems you did something different. Why do you need to know the role at
>> traversal hook time? All you need is to evaluate the portal_skin
>> cookie. And that is done by default.
> Yes, maybe we're talking about different things. Here's what I mean: to
> know the user's role we need to *some* kind of lookup, and as it's not
> stored in the cookie we have to do it during traversal...?
Let's take a look at a plain new CMFDefault site. Everybody without a
portal_skin cookie sees the default skin. So we don't have to change
anything for anonymous users.
'logged_in' calls here/portal_skins/updateSkinCookie to set a
portal_skin cookie based on the member's portal_skin property. This is
the place to set a portal_skin value based on the users role.
All the following requests can use the portal_skin cookie to select the
'logout' calls context.portal_skins.clearSkinCookie() and we are back to
the default skin for anonymous.
So AFAICS we just have to change updateSkinCookie (and default / custom
skin configuration). Or am I missing something?
More information about the Zope-CMF