[Zope3-Users] Confusion about PAU usage.
Garrett Smith
garrett at mojave-corp.com
Fri Aug 26 11:30:00 EDT 2005
The PAU mechanisms involving InternalPrincipal and PrincipalInfo are internal to its workings. From what I can see, these shouldn't impact what you're doing. If you want the grimy details, look at the README.txt doctest file in zope/app/authentication. However, these mainly apply to plugin developers.
To store additional information for a principal, use the principal annotation utility. E.g. were you in a browser view:
util = zapi.getUtility(IPrincipalAnnotationUtility)
annotations = util.getAnnotations(self.request.principal)
I would strongly discourage you from subclassing InternalPrincipal -- it's, well, internal :-)
If annotations aren't working for you, give me the specifics and I'll see if I can help.
-- Garrett
> -----Original Message-----
> From: zope3-users-bounces at zope.org
> [mailto:zope3-users-bounces at zope.org] On Behalf Of Alec Munro
> Sent: Tuesday, August 23, 2005 10:06 AM
> To: frick at sc-networks.com
> Cc: zope3-users at zope.org
> Subject: Re: [Zope3-Users] Confusion about PAU usage.
>
> On 8/22/05, Christoph Frick <frick at sc-networks.com> wrote:
> > On Mon, Aug 22, 2005 at 11:47:40AM -0300, Alec Munro wrote:
> >
> > > In my situation, I am trying to create principals with additional
> > > properties, and initially I did that by extending
> InternalPrincipal.
> > > That worked fine, until I realised that when I
> authenticated, I was
> > > getting back a PrincipalInfo instance, which does not contain the
> > > additional properties. Additionally, I wish to have
> multiple types of
> > > users, so I had extended InternalPrincipal a couple of times, to
> > > create a few different classes, the distinction of which
> is obviousy
> > > lost when authenticating ATM.
> >
> > i guess what you really want here are annotations of
> principals. have a
> > look in the zope3 book you can download from zc's site.
> there is AFAIR a
> > section adressing this problem with lots of examples and i think the
> > section also sheds some light on the whole principal and
> annotation in
> > general.
> >
> > --
> > cu
> >
> >
> >
> I've given this a try, and right now I am having a problem figuring
> out what I am supposed to attach the annotation information to. My
> specific principals are extensions of IInternalPrincipal, which
> doesn't have an ID, and as such, doesn't work for principalannotations
> as I have experienced them so far.
> This is one of the reasons why I would like a guide on the differences
> between InternalPrincipals, PrincipalInfo's, and Principal's. The
> standard Principal Folder contains InterrnalPrincipals, so I assumed
> that was the type I should be extending. I imagine that if I were to
> log in as one of these principals, I might then have access to the
> annotations. However, at least for testing purposes, I would prefer to
> have access to them when doing site management.
>
> Anyone have any advice on how to proceed with this?
>
> Thanks,
>
> Alec
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>
More information about the Zope3-users
mailing list