I have a Settings class that internally does something like that:

if db(db.auth_group.id > 0).count() == 0:
    ...


Hopefully there is a better way to avoid making this query for each
request. Maybe just comment it out later?



On Feb 23, 9:48 am, Matt <[email protected]> wrote:
> Hi Hamdy,
>
> Thanks for your answer.
>
> I guess my initial question was a little bit vague I ended up doing
> something like:
>
> if len(db().select(db.auth_group.ALL)) == 0:
>   auth.add_group('Administrator', 'Manage the website')
>   auth....
>
> Matt
>
> On Feb 22, 10:46 pm, "hamdy.a.farag" <[email protected]> wrote:
>
> > Hi Matt
>
> > add auth.settings.create_user_groups = True in db.py then for every
> > user created a new group is created for him with the name 'user_id'
>
> > To add a custom group once, you may add a function to your model that
> > do the post-registeration stuff [including adding groups]
>
> > def post-registeration_stuff(form):
> >       group = MY_CUSTOM_GROUP
> >       if not id_group(group):
> >              auth.add_group(group)
>
> > auth.settings.register_onaccept = post-registeration_stuff       ->
> > function works only after registeration is accepted
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to