Skip to content
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

Add support for CKAN 2.10.0+ #120

Merged
merged 4 commits into from
Sep 25, 2023

Conversation

themowski
Copy link
Contributor

Overview

This PR adds support for CKAN 2.10.0+ It addresses #116 -- see the issue report for much more detailed information & background.

Notes

Compatibility

This code updates ckanext-ldap to work with released versions of CKAN 2.10. It's worth nothing that alpha versions of CKAN -- those identified as 2.10.0a0 in the upstream CKAN code -- may or may not work, depending on whether or not that version contains the commit that merged ckan/ckan#6560.

If the alpha commit is from after that merge, then this plugin will work as expected.

If not (i.e., the end-user is using CKAN 2.10.0a0 at a commit from before that PR was merged), then the user is functionally running CKAN 2.9.x in terms of authentication. The plugin will not work correctly, and to fix it, they would need to undo the changes from this PR by removing the if toolkit.check_ckan_version() blocks that this PR adds.

(As a note -- I logged ckan/ckan#7777 to hopefully improve this versioning situation in the future.)

I thought about putting notes about this in the code, but decided it was too deep in the weeds -- my thought is that if someone encounters issues this particular issue, they will either upgrade CKAN to a released 2.10 version, or find this PR and roll back the changes locally.

Other changes

I updated the CKAN badge in the README to include 2.10, and emphasize that you support 2.9.7 and higher. Not sure if that's the approach you feel is best; figured I'd at least throw something out there to start with.

Remember Me & CSRF not included

I opted not to implement "Remember Me". I'm not sure if this existed in 2.9, or if it's new to 2.10. The upstream login() code in ckan/ckan v2.9.9 and ckan/ckan v2.10.1 differs quite a bit (because of the migration to flask-login). If this is 2.10-only, we can probably do something similar to what CKAN does. Otherwise, we'll need to understand how CKAN 2.9 is doing it, and probably add some conditional logic.

Similarly, I opted not to try implementing the CSRF protection. After some quick reading, I still don't fully understand what it's about, so I don't feel confident enough to tackle that. I'm not really sure how to test it, since I'm not a front-end developer.

Regardless of all this, I think both of those features should be handled via separate issues/PR's, as they are not strictly necessary for 2.10 support.

@@ -7,3 +7,4 @@ build/
dist/
.idea
**/node_modules/
.vscode/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can roll this back if needed -- added it because I'm a VS Code user and had some local configs I wanted to ignore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a problem at all, thanks for adding it! 🙂

Copy link
Member

@jrdh jrdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I've tested it and it works, thanks so much! 🚀

@jrdh jrdh changed the base branch from main to dev September 25, 2023 11:31
@jrdh jrdh merged commit 18b5e47 into NaturalHistoryMuseum:dev Sep 25, 2023
@jrdh jrdh mentioned this pull request Sep 25, 2023
@themowski
Copy link
Contributor Author

No problem, thanks for your patience while I got things set up to contribute!

@themowski themowski deleted the 116-support-ckan-2.10 branch September 25, 2023 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants