-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to Flask-RestX #73
Conversation
Fixes: fedora-infra#25 Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
@abompard I've gone through this now commit-by-commit and I have no comments! This PR is crazy good. The pagination code is the only part I'm not 100% clear on how it is working. It might benefit from some comments maybe for us simpler folk :P One thing: I noticed when I hit an endpoint and I omit the trailing slash like so |
Thanks! If you omit the trailing slash you should get a redirect response with a The pagination is... yeah. LDAP makes things pretty complex, because it has an internal model of pagination that we can barely use because it can't be use with different LDAP connections, therefore with different HTTP requests. So I'm using the same technique that IPA uses: I request the whole list of record IDs from LDAP, but just the IDs, not the full data. Then I slice that into pages and keep the requested page, and for those IDs only I get the full data. I agree this would benefit from some docs, could you be more precise as to which parts you thought weren't clear? Anyway, thanks, I'll merge it as is so we can build new stuff upon it. Thanks a lot for the review! |
e5dd183
to
8b64c43
Compare
Ah, I somehow didn't spot the redirect.
Even this description helps make |
Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
Fixes: fedora-infra#55 Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
Fixes: fedora-infra#29 Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
I've added some docsting but it's severely lacking in that area. I'll try to add more later. For now I'll just merge this PR so we can start building upon it (I plan on fixing the CI script next) |
Fixes #25, #55
Also fixes/implements pagination, fixes a security issue related to the reuse of ldap connections, and fixes/implements credentials delegation so that LDAP queries are done as the connecting user and not the HTTP service (#55).
Using Flask-RestX (or Falsk-Restful) will save us code (and tests) for the REST API mechanics.
Related to #31 since Flask-RestX automatically generates and publishes the OpenAPI spec by introspecting the code and comments. I don't consider #31 entirely fixed by this PR because we need to improve the code's documentation to get the spec to a decent documentation level.
Code coverage is not 100% but I'll improve it over time.