login_bare needs a password ?

53 views
Skip to first unread message

António Ramos

unread,
Aug 16, 2019, 2:22:33 PM8/16/19
to web...@googlegroups.com
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


Dave S

unread,
Aug 16, 2019, 3:05:10 PM8/16/19
to web2py-users

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

António Ramos

unread,
Sep 18, 2019, 12:39:11 PM9/18/19
to web...@googlegroups.com
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

--
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 web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/73d3afa6-27b0-4a14-978a-82107713b3d6%40googlegroups.com.

António Ramos

unread,
Sep 18, 2019, 1:09:31 PM9/18/19
to web...@googlegroups.com
apparently i need to be logged in first. 

solved!

António Ramos

unread,
Sep 18, 2019, 1:16:03 PM9/18/19
to web...@googlegroups.com
or maybe not
I tried to impersonate other user that has membership PORTEIRO and i get "Forbidden"

António Ramos

unread,
Sep 19, 2019, 4:42:52 AM9/19/19
to web...@googlegroups.com
any help?

Massimo Di Pierro

unread,
Sep 21, 2019, 11:44:21 AM9/21/19
to web2py-users

Can you logout and login again? The group membership is cached and maybe you changed after you tried the code.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages