[Zope-CMF] cannot get authenticated user

Florent Guillaume fg@nuxeo.com
Sat, 19 Oct 2002 19:32:56 +0000 (UTC)


portal_membership.getAuthenticatedMember() basically does
getSecurityManager().getUser() (then wraps it in a MemberData
datastructure) so it won't help.

The user is authenticated only when traversal has finished. But setting
the skin is done during traversal...

Florent

Kevin Carlson <khcarlso@bellsouth.net> wrote:
> Try portal_membership.getAuthenticatedMember() instead.
> 
> Kevin
> 
> -----Original Message-----
> From: zope-cmf-admin@zope.org [mailto:zope-cmf-admin@zope.org]On Behalf
> Of Rocky Mazzeo
> Sent: Friday, October 18, 2002 1:27 PM
> To: zope-cmf@zope.org
> Subject: [Zope-CMF] cannot get authenticated user
> 
> 
> Under the hood question:
> I'm trying to extend Products.CMFCore.SkinsTool for a personal project.
> Basically I want to over-ride getSkinByName to run little logic and return
> the skin based on Role/Permission/URL.
> 
> I am running into a stumbling block in that 'getSecurityManager.getUser()'
> is always returning the Anonymous User. I removed the CookieCrumbler (hoping
> it was just that it hadn't been called yet), but even standard HTTP
> Authentication Headers are returning the Anonymous User.
> 
> Is it possible to get the User object at this level? Can someone offer
> advice as to what I could be missing? Here is a stripped down version of my
> class:
> 
> class CMFSkinsToolRules(SkinsTool):
>   #...
>   def getSkinByName(self,name):
>     #...
>     strSkinName = self.getSkinByRule()
>     #...
> 
>   def getSkinByRule(self):
>     strSkinName = None
>     # HERE IS THE PROBLEM
>     objUser = getSecurityManager().getUser()
>     # objUser is always the Anonymous User
>     #...
> #...
-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com