[Zope3-Users] Help needed for Principal / PrincipalSources

Adrien Di Mascio Adrien.DiMascio at logilab.fr
Thu Jan 6 11:51:15 EST 2005


Hi there,

[ -*- Sorry for the long mail -*- ]

I need some advices to use Principal / PrincipalSource. I'll try to describe
briefly the context :

I've got a completly separate "server application" on which a user can
connect using host/login/password. Once the user is connected, he can
make several queries and the server-side API is quite similar to the
DB-API. As you can see, it's juste a quite common use case.

OK, so I've got this app, and I've also got a Zope3 instance on which I would
like to have pages that go and query this remote app and finally display
the received results.

I'm new to Zope3 (and don't know Zope2), so I've followed step by step the
Zope3Book (The "New principal source plugin" chapter), but I still can't get
it work.

First of all, the configure.zcml's browser directives listed in the chapter
did not work for me. I had the following error :

zope.configuration.config.ConfigurationExecutionError:
  exceptions.KeyError: u'add_principal_source' in:
  File "/home/adim/[...]/erudi/repoauth/configure.zcml", line 32.2-41.5
    <browser:addform
     schema=".interfaces.IRepoPrincipalSource"
     label="Add Erudi Principal Source"
     content_factory="erudi.repoauth.ErudiDBPrincipalSource"
     fields="repo_name repo_host"
     arguments="repo_name repo_host"
     name="add_reposource.html"
     menu="add_principal_source" title="Erudi Authentication Source"
     permission="zope.ManageContent"
     />

So I changed "add_principal_source" into "zmi_actions", but I then had
to add a "browser:addMenuItem" directive to make the new link appear.

I've then created a simple page ("homepage.pt"), and I've restricted
its access to Site Members, but what I want is to authorize every
authenticated users (including users authenticated against my
new principal source).

How can I do that ??

I think the solution is to map the "SiteMember" role on each principal
but when I try to do this, the following exception occurs :

####################
2005-01-06T17:28:29 ERROR SiteError http://libra:8080/Intranet%20homepage/@@PrincipalRoles.html
Traceback (most recent call last):
  File "/home/adim/local/zope/lib/python/zope/publisher/publish.py", line 138, in publish
    result = publication.callObject(request, object)
    
  [ ... Skipping some stack entries ... ]

  File "/home/adim/local/zope/lib/python/zope/app/securitypolicy/browser/principalroleview.py", line 55, in
   createGrid
    principals = [auth_service.getPrincipal(principal)
  File "/home/adim/local/zope/lib/python/zope/app/pluggableauth/__init__.py", line 136, in getPrincipal
    return next.getPrincipal(id)
  File "/home/adim/local/zope/lib/python/zope/app/security/principalregistry.py", line 75, in getPrincipal
    raise NotFoundError(id)
NotFoundError: u'nico:repo_test'

172.17.1.74 - zope.manager [6/Jan/2005:17:28:29 +0200]
  "POST /Intranet%20homepage/@@PrincipalRoles.html HTTP/1.1" 200 292 "http://libra:8080/Intranet%20homepage/@@PrincipalRoles.html" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041128 Firefox/1.0 (Debian package 1.0-4)"
####################

I'm a bit lost here ... Do I need to register myself my principals into the registry ?
Any help would be welcome.

Cheers,
Adrien.

P.S. : can anyone tell me what are all the "metaconfigure.py" files ?


-- 
Adrien Di Mascio
LOGILAB, Paris (France).
http://www.logilab.com   http://www.logilab.fr   http://www.logilab.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20050106/58132e99/attachment.bin


More information about the Zope3-users mailing list