Hello All,

I would like to get your opinions on what seemed to me useful additions to 
the `auth.backends.ModelBackend`. These are polled by the `auth.models` and 
not every backend has to implement them.

1) clear_cache()

default backend caches permissions at `user._user_perm_cache`, 
`user._group_perm_cache` and cumulatively: `user._perm_cache`. Most other 
backends also do things similar. If an app uses 2-3 backends, resetting 
cache after adding a permission becomes a chore. 

2) has_perms_any ()

we have one (has_perms) that requires *all* permissions given, why not *any*? 
If this makes it, the other may also be renamed to has_perms_all ()

3) get_permisson_objects ()

guardian has something like this, and i think it would be nice if the 
default backend also provided similar. if it did, it would be either 
Model.objects.all() or Model.objects.none(); does not look much useful, 
however if one uses say 3 backends, it does seem useful. If implemented, 
due to diverse nature of backends it may be hard, if at all possible, to 
implement lazy loading, thus, may incur performance costs. If you think 
this is useful, please also share if you have design ideas. 

4) get_backends ()

this is not really a utility method, but a move request. It is currently 
under auth.__init__(); I think if it was moved to somewhere that could be 
overrided, it would allow one to pick and choose backends locally from the 
code if needed. 

Regards,

Mehmet

-- 
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 django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
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/0ca47426-e700-473e-ba49-5eb748210a38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to