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

Support custom user model #6418

Closed
wants to merge 14 commits into from
Closed

Conversation

matmair
Copy link
Member

@matmair matmair commented Feb 5, 2024

This PR refactors the usage of the build in User model to support custom auth models

  • refactors all uses of User
  • Add migrations/refactor migrations
  • Docs
  • [ ] unit tests to ensure custom user models work

@matmair matmair added this to the 1.0.0 milestone Feb 5, 2024
@matmair matmair self-assigned this Feb 5, 2024
Copy link

netlify bot commented Feb 5, 2024

Deploy Preview for inventree-web-pui-preview canceled.

Name Link
🔨 Latest commit 9546179
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/664d272782d5860008816863

@wolflu05
Copy link
Contributor

wolflu05 commented Feb 6, 2024

Does this also break related model fields in plugins that use the auth.user model?

@matmair matmair added the breaking Indicates a major update or change which breaks compatibility label Feb 6, 2024
@matmair
Copy link
Member Author

matmair commented Feb 6, 2024

@wolflu05 yes, that is the main "breaking" thing

@matmair matmair changed the title Support custom user model [WIP] 1.0 - Support custom user model Feb 6, 2024
@matmair matmair modified the milestones: 1.0.0, 0.16.0 Apr 6, 2024
@matmair matmair changed the title [WIP] 1.0 - Support custom user model [WIP] Support custom user model Apr 6, 2024
@matmair
Copy link
Member Author

matmair commented Apr 6, 2024

This is targeted for 0.16.0 now and will be revisited once 0.15.0 is out.

I think it is already advisable for plugin deps to either target Owners or the django.cong.settings auth model - a list of best practices is on my personal roadmap for 0.16.0

@matmair matmair changed the title [WIP] Support custom user model Support custom user model Apr 8, 2024
Copy link

codecov bot commented Apr 23, 2024

Codecov Report

Attention: Patch coverage is 91.17647% with 3 lines in your changes missing coverage. Please review.

Project coverage is 83.43%. Comparing base (bb93c91) to head (9546179).
Report is 296 commits behind head on master.

Files Patch % Lines
src/backend/InvenTree/InvenTree/serializers.py 66.66% 1 Missing ⚠️
src/backend/InvenTree/build/api.py 50.00% 1 Missing ⚠️
src/backend/InvenTree/users/api.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6418      +/-   ##
==========================================
- Coverage   83.96%   83.43%   -0.54%     
==========================================
  Files        1057     1046      -11     
  Lines       46498    45806     -692     
  Branches     1360     1192     -168     
==========================================
- Hits        39043    38217     -826     
- Misses       7102     7335     +233     
+ Partials      353      254      -99     
Flag Coverage Δ
backend 85.42% <91.17%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@matmair matmair marked this pull request as ready for review May 21, 2024 23:00
@SchrodingersGat
Copy link
Member

@matmair LGTM

  • Any documentation needed around this?
  • What happens to the migrations if a custom user model is actually used? Do we need to edit existing migrations?

@matmair matmair marked this pull request as draft July 17, 2024 16:35
@matmair
Copy link
Member Author

matmair commented Jul 17, 2024

Needs docs

  • What happens to the migrations if a custom user model is actually used? Do we need to edit existing migrations?

I have tested that it works but I will try to add a CI test for that too

@SchrodingersGat
Copy link
Member

@matmair do you want to target 0.16.x or bump to 0.17.x?

@matmair
Copy link
Member Author

matmair commented Aug 5, 2024

@SchrodingersGat let's move this, I am focusing on getting user custom states in for 0.16.x

@matmair matmair modified the milestones: 0.16.0, 0.17.0 Aug 5, 2024
@matmair
Copy link
Member Author

matmair commented Aug 18, 2024

Closing this in favour of an upcoming PR that adds a custom user model

@matmair matmair closed this Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Indicates a major update or change which breaks compatibility refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants