[Zope] AUTHENTICATED_USER.name vs .getUserName() (was RE: hiding site co ntent based upon a domain?) ntent based upon a domain?)

Jeffrey Shell Jeffrey@digicool.com
Fri, 6 Aug 1999 11:53:48 -0400


> No.  The problem is that:
> 
> <!--#if "AUTHENTICATED_USER=='AnonUser'"-->
> 
> Should be:
> 
> <!--#if "AUTHENTICATED_USER.name=='AnonUser'"-->
> 
> Because AUTHENTICATED_USER is a user *object*, not a string.  
> The string
> representation of a user object is its .name attribute, but 
> if you try to
> just compare a user object to a string, it will always fail.

The more preferred way is to use AUTHENTICATED_USER.getUserName(), since
more complex User Folders (UserDb's, LDAP User Folders, etc) might
construct the user from different attributes.  There are some basic
methods defined on the BasicUser object (from which most AUTH_USER's are
derived) for getting the user name, roles, roles in context, etc.