You do not need two decorators:
@auth.requires_login()
@auth.requires_membership('risorse_umane' or 'admin')
auth.requires_membership also requires login.
You cannot do
@auth.requires_membership('risorse_umane' or 'admin')
because that is the same as
@auth.requires_membership('risorse_umane')
since 'risorse_umane' evaluates to True.
There may be something else going on.
On Friday, 12 October 2012 10:04:35 UTC-5, piero crisci wrote:
>
> I tryed to find others with the same iusse problem without understand how
> to solve the problems :(
>
> I set in the db.py the follow table
>
> ########################################
> db.define_table('auth_user',
> Field('username', type='string',
> label=T('Username')),
> Field('first_name', type='string',
> label=T('First Name')),
> Field('last_name', type='string',
> label=T('Last Name')),
> Field('email', type='string',
> label=T('Email')),
> Field('password', type='password',length=512,
> readable=False,
> label=T('Password')),
> Field('created_on','datetime',default=request.now,
> label=T('Created On'),writable=False,readable=False),
> Field('modified_on','datetime',default=request.now,
> label=T('Modified On'),writable=False,readable=False,
> update=request.now),
> Field('registration_key',default='',
> writable=False,readable=False),
> Field('reset_password_key',default='',
> writable=False,readable=False),
> Field('registration_id',default='',
> writable=False,readable=False),
> format='%(username)s',
> migrate=settings.migrate)
>
>
> db.auth_user.first_name.requires =
> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
> db.auth_user.last_name.requires =
> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
> #db.auth_user.password.requires = [ IS_STRONG(min=8,
> number=1,special=1,error_message = "La password deve contenere almeno 8
> Caratteri, un Numero, un Carattere Speciale, un carattere Maiuscolo"),
> CRYPT(key=auth.settings.hmac_key)]
> db.auth_user.password.requires= [*IS_STRONG(min=8),
> CRYPT(auth.settings.hmac_key)*]
>
> db.auth_user.username.requires = IS_NOT_IN_DB(db, db.auth_user.username,
> error_message = 'Username già censita')
> db.auth_user.email.requires =
> (IS_EMAIL(error_message=auth.messages.invalid_email),
> IS_NOT_IN_DB(db,
> db.auth_user.email,error_message = 'Email già censita'))
> auth.define_tables(migrate = settings.migrate)
>
> I set in the default.py this def for manage the user changes .
>
> @auth.requires_login()
> @auth.requires_membership('risorse_umane' or 'admin')
> def anagrafica_utenti_db_manage():
> form = SQLFORM.smartgrid(db.auth_user,onupdate=auth.archive)
> return locals()
>
> When i try to modify the name or the surname the framework rise the
> IS_STRONG control even if i don't touch the password string.
> I am new with web2py and i want just to know if i need to create a form to
> make the user changes or i can fix this problem using the smartgrid.
> I also set the "Requires approval" for the new registration. How can i
> delete the "Pending" in the registration key ? (I can t do it right now
> because of the IS_STRONG control.
> Thanks for help
> And sorry for bother you
>
--