SOLVED (6 months later)
I put this aside six months ago when I couldn't make it work. Today I
really needed it so I dug out pdb and drilled down into
auth.has_permission(). Finally, the light dawned on me. The table_name
field is a string! Changing it to "auth_user" fixed the problem. May I
suggest a couple of changes to keep others from stumbling where I did?
The online book current has (emphasis mine):
"""
impersonate allows a user to "impersonate" another user. This is important
for debugging and for support purposes. request.args[0] is the id of the
user to be impersonated. This is only allowed if the logged in
userhas_permission('impersonate',
*db.auth_user*, user_id).
"""
That should be changed to has_permission('impersonate', "*auth_user"*,
user_id)
It would also help if auth.has_permission threw a ticket if given a bad
table_name argument, maybe something like:
if not hasattr(db, table_name) and isinstance(getattr(db, table_name),
db.Table):
raise ValueError("Table {} doesn't exist in db".format(table_name))
Thanks,
Mike
--
---
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/groups/opt_out.