Nevermind. I thought there was a builtin web2py way for this but I
just did this instead (after sifting more through the groups):

def groupadd(check_group):
    if not db(db.auth_group.role==check_group).count():
     db.auth_group.insert(role=check_group)

groupadd('Admins')
groupadd('Maintenance Users')
groupadd('Download Users')

auth.settings.register_onaccept=lambda form:
auth.add_membership(auth.id_group('Download Users'),form.vars.id)
----------------------------------------------------------------------------------------------

On Apr 1, 12:06 pm, Mike <m.she...@gmail.com> wrote:
> DISCLAIMER: very new to web2py, read book and building first app...
>
> I'm having some brain cramps trying to add some default groups.
> Basically I need some default groups set-up when I rollout my
> application, like Admins, End-Users, Management - when users register
> one of us will manually filter them into the right group (this is fine
> for our environment). What's the best way to do that? I just made some
> add_group lines in my model but it keeps recreating the group role on
> every launch and I got a bunch of duplicates.
>
> Thanks in Advance

Reply via email to