#28713: ModelBackend call to get_all_permissions() makes get_user_permissions()
return all permissions
--------------------------------------------------+------------------------
               Reporter:  Yuri Kaszubowski Lopes  |          Owner:  nobody
                   Type:  Bug                     |         Status:  new
              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                       |
--------------------------------------------------+------------------------
 django.contrib.auth.backends.ModelBackend.get_all_permissions() overwrites
 the _user_perm_cache as:


 {{{
 user_obj._perm_cache = self.get_user_permissions(user_obj)  # returns the
 set that is mutable
 user_obj._perm_cache.update(self.get_group_permissions(user_obj))  #
 therefore, the set is changed here
 }}}


 An alternative solution would be:
 {{{
 user_obj._perm_cache = set()
 user_obj._perm_cache.update(self.get_user_permissions(user_obj))
 user_obj._perm_cache.update(self.get_group_permissions(user_obj))
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28713>
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/054.ab082a1f4f400699a88db172a76d5fdf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to