The new user id should be in form.vars.id as well as session.auth.user.id 
at that point.

Is there a potential security problem here -- what would prevent someone 
from manually altering the first arg in the URL to any arbitrary group 
(e.g., "admin")? Perhaps you should check the value of request.args(0) 
before making the group assignment.

Anthony

On Friday, April 20, 2012 4:49:24 PM UTC-4, cyan wrote:
>
>
> Hi Group,
>
> I have something like the following in a model:
>
> def grant_permissions(form):
>     group_id = auth.id_group(role=request.args(0)) 
>     auth.add_membership(group_id, auth.user.id)
>
> auth.settings.register_onaccept.append(grant_permissions)
>
>
> Basically, I want to assign a user to a group upon his/her successful 
> registration. However, when I execute the above, I get an 
> AttributeError: 'NoneType' object has no attribute 'id'
>
> . I tried to follow the code example on page 414 of the manual, but 
> referencing using 
> auth.user.id
>
> doesn't seem to work.
>
> So how can I get hold of the user id here for the user who has just 
> successfully registered? Thanks.
>
> *
> *
>

Reply via email to