问题
I am using User Restricted Resource Access to isolate documents between users.
Is it possible to retrieve the AUTH_FIELD
value set during request authentication? I need to filter out only the documents for the current user when doing Pymongo queries in an Event Hook, the same way Eve does.
回答1:
I can't tell if this is the best way, but I found the value inside the flask app under current_app.auth.get_request_auth_value()
.
来源:https://stackoverflow.com/questions/35203030/python-eve-get-auth-field-value-inside-an-event-hook