[Zope3-Users] Confusion about PAU usage.

Alec Munro alecmunro at gmail.com
Fri Aug 26 13:39:42 EDT 2005


Hi Garrett,

Thanks for the response.
So far, I have subclassed InternalPrinciple, because I was looking to
create a container based principal source, and PrincipalFolder seemed
like the obvious choice to subclass at the time. Because
PrincipalFolder contains InternalPrincipals, I subclassed
InternalPrincipal to create my principal classes (I have three, each
representing different types of users). I'm sure that this was the
wrong way to do things, but it gave me quick satisfaction, by allowing
me to use the ZMI add menu to add each of my three types of principals
and Authenticate against them.
So having three types of users was one of my requirements. The
differences between these users are relatively small, but having them
in separate classes seems to allow me quite a lot of control.
Another requirement,as mentioned, each of these principles has
properties, which would ideally be editable by a manager at any
time(at least during development), or the users themselves, once
logged in.
What is the preferred way to do this?
I'm not entirely attached to subclassing to differentiate my
principles, but it does allow me to use Principal Annotations in a way
that is very clear to me.
Thanks for your help,

Alec

On 8/26/05, Garrett Smith <garrett at mojave-corp.com> wrote:
> 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