I would like to know if there is a way to automatically create a plomino user (author) in a database when a user registers with plone.
there are several possibilities:
- if you just want any registered user to have Plomino Author access in your Plomino db, you just need to go to the db ACL tab, and set Authenticated to Plomino Authors (in Generic users access rights section)
- you can also create a group in your plone site, put users in this group and give Plomino Author access to this group in the ACL
- and if you really want to add any new registered user as Plomino Authors (which is not a good idea as it will produce a very very long list of entries in your ACL, it is much better to use a group), then you need to copy registry.cpy and registry.cpy.metadata from Products/CMFPlone/skins/plone_login into your skin product and make some changes to add the user id in the db ACL
Thanx for the detailed options . Trying the first one, I set Generic Authenticated to plomino_authors, registerd a new user and created a doc. The form sends emails in the onsave event but when the code calls hasUserRole(user.id, somerole) it throws "You are not allowed to access 'id' in this context". I then refreshed the db and now it doesn't throw the error. Should I call a db refresh from the plone registration process? BTW, I think you meant register.py and not registry.cpy .
Database refresh is expensive, so you definitely don't want to do it whenever you add a doc.
Run your Zope instance in the foreground so that you get verbose errors, and make sure you're logging tracebacks for Unauthorized. See if this gives you any clues.
In this setup, there should be no difference between an authenticated Plone member and any other member with PlominoAuthor role.
I think I've found the problem - my users register as remember users. When I sign up as a normal plone member, I don't get the problem. If I sign up as a remember subclassed member I cannot access id directly so I tried getId(). This works if I run a db refresh. Any pointers to get me on my way?
Investigate what the crucial difference is between remember members and regular members.
Any API or permission differences?
1. try .getMemberId() instead of .id
2. be careful
- Plomino_Authors is a field (it stores the document authors),
- PlominoAuthor is an access right (manage in the ACL)
3. i do not understand why your refreshdb avoid the error, but i do not recommend to run it from registration
4. yes I meant register.py :)
sorry I missed your post about Remember
ok, so maybe getId() is right method
I think you should import your db on a simple Plone site without remember to check if it behaves correctly, and if it is the case, then try again with remember and investigate using clouseau or pdb
getMemberId solved the problem. Thanks again Eric.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.