Am Montag, 27. März 2017 16:11:06 UTC+2 schrieb Melvyn Sopacua:
>
> On Friday 24 March 2017 04:31:32 guettli wrote:
>
> > I know this is a crazy idea, and it will get the "won't fix" tag very
>
> > soon.
>
> >
>
> > Nevertheless I want to speak it out.
>
> >
>
> > My use case: Get a queryset of users who have a given permission.
>
>
>
> I'm still thinking about this use case.
>
> Cause it's not for normal use - you don't normally use permissions as
> data, you use permissions to deny / allow access to data.
>
> So, you're already in the "specialized" corner.
>
>
>
I can use more words, to make this use case more colorful.
Imagine a approval workflow: Only some users are allowed to do the approval.
An invoice instance needs to be forwarded to someone with the matching
permissions.
This way I want to provide a html form where the current user can choose
the user with the matching
permissions.
> > At the moment this query is complex and results in performance issues,
>
>
>
> For a small install this works fine. When performance becomes an issue
> because there's a large number of users and groups, my first instinct is to
> regroup users so that no permission exceptions exist anymore at the user
> level.
>
> I'd add all superusers to the "wheel" group ("root", "superuser", whatever
> floats your boat).
>
> Now the query to get this info no longer requires the user model for
> conditions and you can simply query the group manager.
>
> It is what groups are for and it'll be always faster get all the matching
> groups as one set and combine it with all the users that have the
> permission assigned directly.
>
> The "one query" requirement conflicts with your performance requirement.
>
>
Unfortunately the current sql query has several outer joins and takes
several seconds even with only very few data in the database.
We have a work-around this. The basic part is published here:
https://code.djangoproject.com/ticket/27260#comment:10
>
>
> --
>
> Melvyn Sopacua
>
--
You received this message because you are subscribed to the Google Groups
"Django developers (Contributions to Django itself)" 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].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/8803a089-4497-47a8-bfcd-3fe31e0d9ffb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.