#29748: Support AUTH_GROUP_MODEL to optimize  django group permission design
----------------------------------------+----------------------------
               Reporter:  damoncheng    |          Owner:  damoncheng
                   Type:  New feature   |         Status:  assigned
              Component:  contrib.auth  |        Version:  master
               Severity:  Normal        |       Keywords:
           Triage Stage:  Unreviewed    |      Has patch:  1
    Needs documentation:  0             |    Needs tests:  0
Patch needs improvement:  0             |  Easy pickings:  0
                  UI/UX:  0             |
----------------------------------------+----------------------------
 The information is not enough for the most project in
 django.contrib.auth.models.User and django.contrib.auth.models.Group. The
 project can only custom User and Team model.

 The auth User can be changed in the django settings by AUTH_USER_MODEL.
 But the Group cannot.

 Further, There are many group permissions problem presented when project
 use django permissions.

 Firstly, In django.contrib.auth.ModelBackend,  Django currently bind group
 permissions with django.contrib.auth.models.Group


 {{{
 def _get_group_permissions(self, user_obj):
     user_groups_field = get_user_model()._meta.get_field('groups')
     user_groups_query = 'group__%s' %
 user_groups_field.related_query_name()
     return Permission.objects.filter(**{user_groups_query: user_obj})
 }}}


 If the project want to relate the group permission to custom team. the
 project have to custom backend that extend
 django.contrib.auth.ModelBackend and modify group to team.

 Secondly,  the bad design limit the other app design,  many app about
 django permission , only  support group permission based on
 django.contrib.auth.models.Group, like django-guardian.

 In the conversation with  Adam
 Johnson([https://groups.google.com/forum/#!topic/django-
 developers/llQJZUKejXg]).  Admin suggestion me to contribute it or to use
 OneToOneField to solve the basic problem. But the OneToOneField is not
 elegant and it have problem in  some scene. For example,  A project is a
 cloud item,  It use SCIM to manage user and team  identities in cloud.  it
 transfer resource from sender to many receiver.

 Before the  project use OneToOneField,   The project  only transfer user
 and team from sender to receiver.   It spend 2 hour.

 After the project use OneToOneField.  The project need transfer user and
 team from sender to receiver,  then create group and make team
 OneToOneField to Group in the receiver. It spend 6 hour.

 it degrade the transform performence.

 So please make me to support AUTH_GROUP_MODEL  that optimize django group
 permission design

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29748>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.c5953a9ba0e49a794c3e44e1add65456%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to