[Zope3-Users] Programmatically changing GroupInformation.principals
Andreas Elvers
andreas at work.de
Tue Apr 11 12:38:15 EDT 2006
Hi,
I'm trying to change GroupInformation.principals inside my application,
but I'm getting PrincipalLookupErrors. Here's a demo:
The Demo is a folder with a Site that contains a PAU with one principal
Mr. Test and a group called testgroup. Mr. Test is member of testgroup.
First we setup the demo in ZMI (taking a *deep* breath):
- create a folder 'Test'
- enter Test
- Make Site
- enter Test/++etc++site/default
- create PluggableAuthentication utility with Prefix = pauprefix.
- click register
- click add
- create PrincipalFolder with prefix = principal.
- click register
- Register as principalfolder and add
- add a PrincipalInformation: login = testuser, password=pass, title=Mr.
Test
- go back to pau folder and add a GroupFolder prefix=group.
- register as groupfolder
- add a group: title=testgroup
- go back to pau folder and add groupfolder and principalfolder in
Authenticator Plugins. Click change.
- from the navtree choose the groupfolder that resides in our pau folder.
- click on group 1 (this is actually the testgroup. Why using numbers ?)
- Under the headline "Principal Folder" click on Search.
- Select Mr. Test and click Apply.
- Now click Change at the bottom of the page.
Now stop zope and run debugzope.
# getting pau
>>> pau =
app.root()['Test'].getSiteManager()['default']['PluggableAuthentication']
>>> group = pau['GroupFolder']['1']
>>> group.principals
('pauprefix.principal.1',)
Now: Why does this not work ?
>>> group.principals = ('pauprefix.principal.1',)
Traceback (most recent call last): ...
File
"/usr/local/zope-3.2.0/lib/python/zope/app/security/principalregistry.py",
line 75, in getPrincipal
raise PrincipalLookupError(id)
zope.app.security.interfaces.PrincipalLookupError: 'pauprefix.principal.1'
Thanks for your help.
- Andreas
More information about the Zope3-users
mailing list