[Zope-CMF] Forcing skins by role

Dieter Maurer dieter@handshake.de
Fri, 23 Aug 2002 20:21:26 +0200


Paul Winkler writes:
 > I'd like users to a CMF site I'm working on to
 > see one of two skins, based on whether or not the user has
 > a role.
 > 
 > Aside from a long detour down a horrible hack that ended
 > up nowhere, I've tried a python script / Access Rule
 > setup similar
 > to what Carl Rindell posted on 7/31/02, but I can't 
 > get it working.
 > 
 > Here's my access rule - it's a script (python) obviously:
 > 
 > who = context.portal_membership.getAuthenticatedMember()
 > if who.hasRole(context, ['Manager']):
 >    newskin = 'Skin A'
 > else:
 >    newskin = 'Skin B'
 > REQUEST.set('portal_skin', newskin)
 > context.setupCurrentSkin(REQUEST)
I doubt that this can work:

  When the AccessRule fires, the user is not yet authenticated.

  I expect, "getAuthenticatedMember" will always return
  "Anonymous User".


Dieter