Can you logout and login again? The group membership is cached and maybe you changed after you tried the code.
On Wednesday, 18 September 2019 10:16:03 UTC-7, Ramos wrote: > > or maybe not > I tried to impersonate other user that has membership PORTEIRO and i get > "Forbidden" > > Em qua, 18 de set de 2019 às 18:09, António Ramos <[email protected]> > escreveu: > >> apparently i need to be logged in first. >> >> solved! >> >> Em qua, 18 de set de 2019 às 17:38, António Ramos <[email protected]> >> escreveu: >> >>> Is something like this??? It returns not authorized! >>> >>> auth.add_permission(db.auth_group(role="PORTEIRO")["id"], >>> "impersonate",db.auth_user) >>> auth.impersonate(4)# user 4 is included in the PORTEIRO group >>> >>> Em sex, 16 de ago de 2019 às 20:05, Dave S <[email protected]> >>> escreveu: >>> >>>> >>>> >>>> On Friday, August 16, 2019 at 11:22:33 AM UTC-7, Ramos wrote: >>>>> >>>>> hello the the login bare function >>>>> auth.login_bare(user,pwd) >>>>> needs a password !! >>>>> Why ? >>>>> I dont know the users passwords but need to impersonate some users to >>>>> create records on behalf of them >>>>> >>>>> Am i reading it right ? >>>>> >>>>> Regards >>>>> António >>>>> >>>> >>>> Well, sure, it's a login method, right? >>>> >>>> What you need to look at is the impersonate method, which is described >>>> in the long first section of >>>> <URL: >>>> http://web2py.com/books/default/chapter/29/09/access-control#Authentication >>>> > >>>> >>>> (Speed-read: click instead on >>>> <URL: >>>> http://web2py.com/books/default/chapter/29/09/access-control#Restrictions-on-registration >>>> >>>> > >>>> and scroll up) >>>> >>>> >>>> /dps >>>> >>>> -- >>>> 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]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/web2py/73d3afa6-27b0-4a14-978a-82107713b3d6%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/web2py/73d3afa6-27b0-4a14-978a-82107713b3d6%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/cab71625-398e-4ba4-ab17-46546720ff9d%40googlegroups.com.

