[Zope-CMF] Forcing skins by role

Paul Winkler pw_lists@slinkp.com
Fri, 23 Aug 2002 16:11:53 -0700


On Fri, Aug 23, 2002 at 03:04:52PM -0700, Paul Winkler wrote:
> On Fri, Aug 23, 2002 at 08:21:26PM +0200, Dieter Maurer wrote:
> > I doubt that this can work:
> > 
> >   When the AccessRule fires, the user is not yet authenticated.
> > 
> >   I expect, "getAuthenticatedMember" will always return
> >   "Anonymous User".
> 
> God damn that's strange, but it appears
> you're right.  After updating CMF from CVS
> and using context.changeSkin(skin_name)
> instead of setupCurrentSkin(REQUEST), 
> I've found that the skin is reliably set to
> whatever I put in the "not manager" case.
> 
> Ugh.  Let me see if I can make it work
> based on the AUTHENTICATED_USER value
> in the REQUEST.

... and the answer is: not any way that I can think of. :(
I can look up the user's name in acl_users ( and hope it's
the right one), but I get back a plain vanilla User object,
not AuthenticatedUser, so I don't get a useful has_roles
method.

Is it really the case that nobody has ever done  a site
that skins based on user roles? That's amazing to me.
I can think of all kinds of uses for it.

--PW
--

Paul Winkler
"Welcome to Muppet Labs, where the future is made - today!"