Reputation: 1715
I have several endpoints that I built with Flask. Some of the endpoints should approve requests only for some specific user ids.
Let's say I have:
What is the best way, with Flask, to check if the request can be approved given the corresponding header?
Edit: While there are some good Flask decorators to handle it when we use an ORM with an User table, like here: https://pypi.org/project/Flask-Authorize/ , in my case, I'm not using any ORM
Upvotes: 2
Views: 1002
Reputation: 1067
If I were you, I'd build a custom decorator to control this kind of permissions.
The flow would look like this:
Let me know if that sounds realistic for your use-case, or if you have any questions.
Upvotes: 1