InvenTree icon indicating copy to clipboard operation
InvenTree copied to clipboard

Support custom user model

Open matmair opened this issue 1 year ago β€’ 9 comments

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

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

matmair avatar Feb 05 '24 23:02 matmair

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

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

netlify[bot] avatar Feb 05 '24 23:02 netlify[bot]

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

wolflu05 avatar Feb 06 '24 01:02 wolflu05

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

matmair avatar Feb 06 '24 06:02 matmair

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 avatar Apr 06 '24 21:04 matmair

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 :warning:
src/backend/InvenTree/build/api.py 50.00% 1 Missing :warning:
src/backend/InvenTree/users/api.py 80.00% 1 Missing :warning:
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.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Apr 23 '24 11:04 codecov[bot]

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

SchrodingersGat avatar May 22 '24 00:05 SchrodingersGat

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

matmair avatar Jul 17 '24 16:07 matmair

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

SchrodingersGat avatar Aug 05 '24 10:08 SchrodingersGat

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

matmair avatar Aug 05 '24 17:08 matmair

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

matmair avatar Aug 18 '24 23:08 matmair