Users queryset in clear_permission_cache function could be improved #1648

Closed
setsu opened this Issue Mar 7, 2013 · 5 comments

Comments

Projects
None yet
5 participants

setsu commented Mar 7, 2013

In /cms/cache/permissions.py file

def clear_permission_cache():
    users = User.objects.filter(is_active=True)

might be

def clear_permission_cache():
    users = User.objects.filter(is_active=True,
                                           is_staff=True)

because is quite common to have few administrators and a lot of registered users.

Otherwise, please could you tell me the reason for this logic?
Thank's.

Contributor

kux commented Mar 8, 2013

It's because of the view permissions which can be applied to regular users as well.

I agree that the query might be quite expensive... An alternative would probably be to have a dedicated permissions only cache which you completely clear (=> no db query at all)

Contributor

kux commented Mar 8, 2013

You might also want to look at #1423 which is the reason why the query was added.

Contributor

yakky commented Jul 11, 2013

This should be solved by #1792

Contributor

henning commented Nov 6, 2013

Ift it's solved, can it be closed? I found this issue by looking for "easy picking" but seems there's nothing that can be done to help here...

Contributor

digi604 commented Nov 6, 2013

I think we can close it.

@digi604 digi604 closed this Nov 6, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment