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

feat: add foundation for LDAP in core repository #2923

Merged
merged 4 commits into from
Nov 13, 2023
Merged

Conversation

matthewelwell
Copy link
Contributor

Changes

Adds the foundation for LDAP functionality in the core repository.

Ideally, the ldap_dn attribute would be part of a separate model contained in the LDAP repository but, to reduce friction in moving from the EE image to the private-cloud image in the future, I've added the attribute directly to the existing model as in the EE codebase.

How did you test this code?

This PR just adds the settings and model attribute, no logic to be tested.

@matthewelwell matthewelwell requested review from a team and zachaysan November 3, 2023 18:00
Copy link

vercel bot commented Nov 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 10, 2023 0:50am
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 10, 2023 0:50am
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 10, 2023 0:50am

Copy link
Contributor

github-actions bot commented Nov 3, 2023

Uffizzi Preview deployment-40071 was deleted.

Copy link
Contributor

@zachaysan zachaysan left a comment

Choose a reason for hiding this comment

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

I'm a little confused as to what should happen if some of the settings are left unset. Presumably the LDAP functionality would just fail somewhere, no? If it would, would it be better to ensure that the settings are present if the top LDAP configuration is set?

Since you've probably got a good answer to this question I'm approving the PR since I didn't spot any code errors. Just curious as to the approach.

Comment on lines +951 to +952
if LDAP_AUTH_URL:
AUTHENTICATION_BACKENDS.insert(0, "django_python3_ldap.auth.LDAPBackend")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this throw an exception if a URL is not set?

Copy link
Member

Choose a reason for hiding this comment

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

I think it's because we will include LDAP in every private cloud image... but it's up to the client to enable it (by setting LDAP_AUTH_URL). Is that correct @matthewelwell

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's correct.

api/app/settings/common.py Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Nov 10, 2023

Codecov Report

Attention: 18 lines in your changes are missing coverage. Please review.

Comparison is base (6e6a48b) 95.63% compared to head (87ab033) 95.58%.
Report is 23 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2923      +/-   ##
==========================================
- Coverage   95.63%   95.58%   -0.05%     
==========================================
  Files        1011     1013       +2     
  Lines       29006    29206     +200     
==========================================
+ Hits        27741    27918     +177     
- Misses       1265     1288      +23     
Files Coverage Δ
api/users/migrations/0035_add_ldap_dn.py 100.00% <100.00%> (ø)
api/users/models.py 95.09% <100.00%> (+0.02%) ⬆️
api/app/settings/common.py 83.38% <10.00%> (-4.82%) ⬇️

... and 13 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@matthewelwell matthewelwell added this pull request to the merge queue Nov 13, 2023
Merged via the queue into main with commit 65351e2 Nov 13, 2023
20 checks passed
@matthewelwell matthewelwell deleted the feat/add-ldap branch November 13, 2023 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants