Opened 13 years ago

Closed 11 years ago

#15110 closed New feature (fixed)

User Isolation between sites.

Reported by: jorgeecardona Owned by: nobody
Component: contrib.auth Version: 1.2
Severity: Normal Keywords: multitenancy
Cc: NicoEchaniz Triage Stage: Someday/Maybe
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I want to add a feature in which the users can be isolated between sites, in order to improve multitenancy in django.

I added to auth.User a site field as ForeignKey with null=True and default=None, and in Meta a unique_together=('name', 'site'). The actual tests run without problem with that.

I will add more tests soon.

Ref:

http://code.djangoproject.com/ticket/15089

Attachments (2)

add_site_field.patch (1.8 KB ) - added by jorgeecardona 13 years ago.
Add a site field in user with null=True and default=None, and a new constraint for uniquness between username and site.
modify_create_user_and_tests.patch (3.9 KB ) - added by jorgeecardona 13 years ago.
Modify create_user and unit test.

Download all attachments as: .zip

Change History (12)

by jorgeecardona, 13 years ago

Attachment: add_site_field.patch added

Add a site field in user with null=True and default=None, and a new constraint for uniquness between username and site.

comment:1 by jorgeecardona, 13 years ago

I changed the create_user method in UserManager in order to receive a site object, and also made some testes for integrity error.

by jorgeecardona, 13 years ago

Modify create_user and unit test.

comment:2 by Ramiro Morales, 13 years ago

milestone: 2.0
Needs documentation: set
Triage Stage: UnreviewedSomeday/Maybe

The problem with a change like this (similarly to other proposals made before to change the schema of often used contrib.* apps models) is that it will mean everybody will need to manually modifiy the structure of the DB table(s) associated with the modified model(s).

Moving to the 2.0 milestone, when it hopefully will be worth considering all these backward incompatible changes.

comment:3 by NicoEchaniz, 13 years ago

Cc: NicoEchaniz added

comment:4 by Gabriel Hurley, 13 years ago

Component: Contrib appscontrib.auth

comment:5 by James Addison, 13 years ago

Severity: Normal
Type: New feature

Somewhat related to #15089.

comment:6 by Jacob, 12 years ago

Milestone 2.0 deleted

comment:3 by Aymeric Augustin, 12 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:4 by Aymeric Augustin, 12 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:5 by Aymeric Augustin, 11 years ago

Isn't this problem essentially solved by the custom user models introduced in Django 1.5?

comment:6 by Anssi Kääriäinen, 11 years ago

Resolution: fixed
Status: newclosed

For the usermodel.site field: yes.

I don't think we want to drag this ticket into solving all possible problems when having multiple users with same username, but different site. If there are places which makes this usecase extra complicated lets consider fixing those in separate tickets.

So, closing this as fixed (by custom user models).

Note: See TracTickets for help on using tickets.
Back to Top