Re: [Zope3-Users] Best way to add a Principal to PAU
On Monday 06 February 2006 15:02, Florian Lindner wrote: > Ok, so the way above is the way to go? Almost, except that you do not want to rely on position as you do when getting the pfolder name. > Why is the principal class folder specific? Because principals from LDAP or SQL might not have this type of information. > BTW: Why does z.a.authentication.principalfolder.InternalPrincipal does not > implement z.security.interfaces.IPrincipal? Or let > z.a.authentication.principalfolder.IInternalPrincipal derive from > IPrincipal? Because InternalPrincipal is not a principal, but just the information to create one. Probably a better name for InternalPrincipal would be PrincipalInfo. BTW, you should really read the README.txt file carefully again, especially where it talks about principal creation at authentication time. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Best way to add a Principal to PAU
Florian Lindner wrote: > Am Sonntag, 5. Februar 2006 22:37 schrieb Stephan Richter: >> On Sunday 05 February 2006 12:34, Florian Lindner wrote: >>> I've managed to add a principal to a principal folder inside a PAU: >>> >>> pau = getUtility(IAuthentication) >>> pfolder = pau.keys()[0] >>> principal = InternalPrincipal("def", "pwd123","a title", "a >>> description") pfolder["def"] = principal >>> >>> but I doubt that the most elegant way. How can I achieve do it more or >>> less agnostic form the principal source (or a least from the name and >>> ordinal postion inside PAU)? >> Basically, your application should know the location of the Authentication >> Utility and the name of the principal folder. Also note that the principal >> class is principal folder specific. > > Ok, so the way above is the way to go? > > Why is the principal class folder specific? > > BTW: Why does z.a.authentication.principalfolder.InternalPrincipal does not > implement z.security.interfaces.IPrincipal? Or let > z.a.authentication.principalfolder.IInternalPrincipal derive from IPrincipal? > > Florian > ___ > Zope3-users mailing list > Zope3-users@zope.org > http://mail.zope.org/mailman/listinfo/zope3-users This: from zope.interface import directlyProvides pau = getUtility(IAuthentication) for plugin in pau.authenticatorPlugins: if directlyProvides(plugin, IMyMarkerInterface): pfolder = plugin Seems to me to avoid embarrassment when there are two authenticators in the stack in pau and you can't guarantee the position of the one you want. I think... Rupert ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Best way to add a Principal to PAU
Am Sonntag, 5. Februar 2006 22:37 schrieb Stephan Richter: > On Sunday 05 February 2006 12:34, Florian Lindner wrote: > > I've managed to add a principal to a principal folder inside a PAU: > > > > pau = getUtility(IAuthentication) > > pfolder = pau.keys()[0] > > principal = InternalPrincipal("def", "pwd123","a title", "a > > description") pfolder["def"] = principal > > > > but I doubt that the most elegant way. How can I achieve do it more or > > less agnostic form the principal source (or a least from the name and > > ordinal postion inside PAU)? > > Basically, your application should know the location of the Authentication > Utility and the name of the principal folder. Also note that the principal > class is principal folder specific. Ok, so the way above is the way to go? Why is the principal class folder specific? BTW: Why does z.a.authentication.principalfolder.InternalPrincipal does not implement z.security.interfaces.IPrincipal? Or let z.a.authentication.principalfolder.IInternalPrincipal derive from IPrincipal? Florian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Best way to add a Principal to PAU
On Sunday 05 February 2006 12:34, Florian Lindner wrote: > I've managed to add a principal to a principal folder inside a PAU: > > pau = getUtility(IAuthentication) > pfolder = pau.keys()[0] > principal = InternalPrincipal("def", "pwd123","a title", "a description") > pfolder["def"] = principal > > but I doubt that the most elegant way. How can I achieve do it more or less > agnostic form the principal source (or a least from the name and ordinal > postion inside PAU)? Basically, your application should know the location of the Authentication Utility and the name of the principal folder. Also note that the principal class is principal folder specific. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Best way to add a Principal to PAU
Hello, I've managed to add a principal to a principal folder inside a PAU: pau = getUtility(IAuthentication) pfolder = pau.keys()[0] principal = InternalPrincipal("def", "pwd123","a title", "a description") pfolder["def"] = principal but I doubt that the most elegant way. How can I achieve do it more or less agnostic form the principal source (or a least from the name and ordinal postion inside PAU)? Thanks, Florian ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users