-
Notifications
You must be signed in to change notification settings - Fork 673
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 for auth against user models other than get_user_model() #96
Comments
Well, that turned out to be much easier than anticipated. Passes all 122 tests. Now I need to figure out some tests for the custom user (as opposed to All I had to do was replace:
with:
Then the couple places that used
and then you just use
The |
Actually, I really like where you're going with this. If you want to create a PR, I'll probably merge it in. I feel like having those class properties opens up the ability for people to more easily customize the way things work. It would be nice to have some tests that run through those customizations and then eventually some documentation to describe it. |
In writing the tests, I'm noticing some other things like dependencies on But it's going well so far. Tricky mocking up a couple classes to act like a custom user table without actually making a Django model out of it (which would require populating |
(i.e. the user ID field name needs to be overridable but default to Python makes stuff too easy. |
Well, only one tox test fails:
Seems like a nothingburger, really. Should I do anything about it? |
How's that PR going @davesque? I did a very similar 'workaround' for my case and would appreciate having this in next release :) |
yes +1 for this |
Do we have some progress in this feature? Please for merge ;) |
Any news? |
No progress as david doesn't use this anymore and I don't have time to add new features. PRs are welcome and appreciated! |
I was looking through the code for this module, and I can't use it as-is because
.state
definesUser = get_user_model()
. It would be nice if I could authenticate different tables against different user models.Rationale
In the system I'm building, I want the
AUTH_USER_MODEL
table to be "company employee" users only, and I want "customer" users to be in a separate table. (There may be company employees in the latter table, but we don't want their accounts connected.)Also,
django.contrib.auth
makes demands on the user model that I don't want applied to the customer model, especially given the admin interface.So, to do this, I'd like to just connect the appropriate authentication and permissions plugins for that table. Which means the things in
.state
probably need to not be globals.Plan
I think I just need to take the global-dependent stuff and make a class out of it.
Existing functionality could be maintained by making the current functionality the default.
Do you have a better idea? Would you you interested in pull requests from this fork?
The text was updated successfully, but these errors were encountered: