HUE-8305 [useradmin] Optimize performance on checking Hue permissions if user is in many groups

Review Request #12962 - Created May 17, 2018 and submitted

Ying Chen
hue
master
HUE-8305
hue
enricoberti, jgauthier, johan, ranade, romain, weixia
commit c39d2e9d52b4bc24ee03f3c23b832c4713b64376 (HEAD -> HUE-8305-updated)
Author: Ying Chen <yingchen@cloudera.com>
Date:   Thu May 17 22:28:57 2018 -0700

    HUE-8305 [useradmin] Optimize performance on checking Hue permissions if user is in many groups

:100644 100644 fa68d34d4e... 490808f843... M    apps/useradmin/src/useradmin/models.py
:100644 100644 745e489a70... 4a16c86ce8... M    desktop/core/src/desktop/models.py
:100644 100644 9d2368e833... 9ce9385651... M    desktop/core/src/desktop/views.py


  • 0
  • 0
  • 3
  • 1
  • 4
Description From Last Updated
  1. Looking at it, but would need a second pass to digest it as it is a critical change

  2. 
      
  1. 
      
  2. I was looking at something else and noticed this code is pretty slow!

  3. 
      
  1. Nice!

  2. apps/useradmin/src/useradmin/models.py (Diff revision 4)
     
     

    ?

    self.user.groups.values_list('id', flat=True)

    https://docs.djangoproject.com/en/2.0/ref/models/querysets/#values-list

  3. apps/useradmin/src/useradmin/models.py (Diff revision 4)
     
     

    .count() > 0 --> exists()?

    https://docs.djangoproject.com/en/2.0/ref/models/querysets/#exists

  4. desktop/core/src/desktop/views.py (Diff revision 4)
     
     
  5. 
      
Review request changed

Status: Closed (submitted)

Loading...