Python Eve get AUTH_FIELD value inside an Event Hook

霸气de小男生 提交于 2019-12-12 05:34:58

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!