Thanks so much Silva,
I have declared the code below in default.py
auth.add_group('induvidual', 'induvidual group')
auth.add_group('non_induvidual','induvidual')
if db(db.auth_user.account_type == 'Non Induvidual'):
auth.add_membership(non_induvidual, user_id)
elif db(db.auth_user.account_type =='Induvidual'):
auth.add_membership(induvidual, user_id)
but its like the auth_goup table is not initialized as i get
<type 'exceptions.NameError'> name 'non_induvidual' is not defined
do u i have to db.define_table('auth_group', Field ('role'),
Field('description')) ??
Thanks again
On Thursday, October 13, 2016 at 1:53:32 PM UTC+3, Marlysson Silva wrote:
>
> B) To verify user permission use these decorators , using membership or
> permission decorators.
>
> http://web2py.com/books/default/chapter/29/09/access-control#Decorators
>
> Em terça-feira, 11 de outubro de 2016 22:54:48 UTC-3, Joe Lwe escreveu:
>>
>> Hello,
>> a)How can i specify automatic group assignment on creation of user based
>> on a particular condition.
>> Consider, on signup form a user can select if he is registering as a
>> business or an individual..
>> if user selects business account is automatically assigned group business
>> else assigned to individual group.
>>
>> b)how can i enforce group access control on forms/tables.. i have seen e.g
>>
>> @auth.requires_login()
>> def function ():
>> form = crud(db.tablename, next = '')
>> return dict(form=form)
>>
>>
>> based on the above its like anyone who can login will have access to the
>> function.
>>
>> Thanks those above are troubling me.. thanks so much for your help.. (am
>> a newbie i like web2py thx for your efforts in the project)
>>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.