Joachim Schmitz wrote:
hi,

I have a special usecase for joining new users to a portal.

1. the anonymous user enters an id
2. if this id is in a list of allowed users
  - a new user from a usertemplate is created, especially the user is
added to certain groups.
  - the user-area is created
  - the user automatically logged in and redirected to his personal area.

I see now a chicken and egg problem, especially I don't know how to add
the user programmatically to a certain group.

Is there an example for a similar usecase, where I can take a look at ?

Hi,

Checks of values given by an anonymous user who is trying to register are done in the CPSDefault/skins/cps_default/register.py skin script.
You can customize this script, doing your own id checks.
If values submitted are ok, user is created.

You can automatically login your user from that script by calling the logged_in.py script. Note that it already creates the member area if necessary.

You can add him/her to a group using the groups directory API (edit the entry corresponding to the group). To give an example:
groups.editEntry({'group': 'test',
                  'members': ['user1', 'user2'],
                   })
You can get members already in the group using the getEntry method.
You will have to deal with security issues, as you probably do not want anybody to be able to set the group members. So maybe you will have to use an unrestricted user, in unrestricted code, to do this, as it is already the case in the portal_membership createMemberArea method.

Then at the end you can redirect to the user personal folder using the portal_membership getHomeUrl method.

Regards,

--
Anahide Tchertchian
Mail: at at nuxeo.com - Tel: +33 (0)1 40 33 71 60
Nuxeo Collaborative Portal Server: http://www.nuxeo.com/cps
Gestion de contenu web / portail collaboratif / groupware / open source
_______________________________________________
cps-users mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/cps-users

Reply via email to