Skip to content

Support custom user model - #6418

Closed
matmair wants to merge 14 commits into
inventree:masterfrom
matmair:user-model
Closed

matmair wants to merge 14 commits into
inventree:masterfrom
matmair:user-model

Conversation

@matmair

@matmair matmair commented Feb 5, 2024 •

Copy link
Copy Markdown
Member

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
@netlify

netlify Bot commented Feb 5, 2024 •

Copy link
Copy Markdown

✅ 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

wolflu05 commented Feb 6, 2024

Copy link
Copy Markdown
Member

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 matmair mentioned this pull request Feb 6, 2024
3 of 8 tasks
@matmair

matmair commented Feb 6, 2024

Copy link
Copy Markdown
Member Author

@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

matmair commented Apr 6, 2024

Copy link
Copy Markdown
Member Author

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
@codecov

codecov Bot commented Apr 23, 2024 •

Copy link
Copy Markdown

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 620 commits behind head on master.

Files with missing lines 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
@matmair
matmair requested a review from SchrodingersGat as a code owner May 21, 2024 23:00
@SchrodingersGat

Copy link
Copy Markdown
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

matmair commented Jul 17, 2024

Copy link
Copy Markdown
Member Author

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
Copy Markdown
Member

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

@matmair

matmair commented Aug 5, 2024

Copy link
Copy Markdown
Member Author

@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

matmair commented Aug 18, 2024

Copy link
Copy Markdown
Member Author

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