[Zope] Re: user attributes

Tres Seaver tseaver at palladion.com
Tue Feb 13 12:55:01 EST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alan wrote:
> Dears,
> 
> I have in a external method
> 
> user = REQUEST.AUTHENTICATED_USER
> 
> And so I can get user.getUserName(), user.getAllGroupNames() but I
> cannot find how to get user's full name and user's e-mail. Any idea?
> 
> Many thanks in advance.

Depends.  In a classic Zope user folder, there are no such properties at
all.  In a CMF / Plone site built against such a user folder, those
properties are normally kept in a separate store, the
'portal_memberdata' tool, and "wrapped" around the user folder's user
object.  In this case, you get the wrapped object via:

  from Products.CMFCore.utils import getToolByName
  mtool = getToolByName(self, 'portal_membership')
  if not mtool.isAnonymousUser():
      member = mtool.getAuthenticatedMember()
      email = member.email

In a PAS-driven site, the user object may have the properties you want
already, based on the configured plugins.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF0ft1+gerLs4ltQ4RAg8wAJ4uz3Nr+mnJ88zUixHYibApdEFeHQCgsr58
chfGPI6fxhddDh0cm6DG2Qg=
=la6y
-----END PGP SIGNATURE-----



More information about the Zope mailing list