Hi Stephan,

Thanks for the reply. My purpose was to be able to test for an
authenticated user. My solution was to add a subclass of BrowserView
with the following:

    def isLoggedIn(self):

        dummy = self.request.principal

        pau = getUtility(IAuthentication,'',self.context)
        principal = pau.getPrincipal(dummy.id)

        if getattr(principal,'id',None) == 'zope.anybody':
            return None
            return True

this is avalaible in the template as context/@@is_logged_in.

So much for my solution, is there a better way. :-)

Best regards,
Darryl Cousins

On Fri, 2005-07-15 at 14:08 -0400, Stephan Richter wrote:
> On Thursday 23 June 2005 21:52, Darryl Cousins wrote:
> > and as such has **no getLogin method**.
> This is correct. zope.security.interfaces.IPrincipal does nto specify a 
> "getLogin()" method.
> > I would have expected it to provide InternalPrincipal as it appears to
> > in default/PluggableAuthenticatin/principals/testuser/@@introspector
> No, the InternalPrincipal is only the data container. A principal is always 
> generated for each request. This is a new paradigm in the authentication 
> code.
> > Any suggestions?
> Why do you need getLogin? The id or title of the principal are commonly 
> available. The login name is usually protected information.
> Regards,
> Stephan
Darryl Cousins <[EMAIL PROTECTED]>
Tree Fern Web Services
106 Sandes St
New Zealand
**64 (0)7 868 3139

Zope3-users mailing list

Reply via email to