django-guardian 1.0.4 documentation
Generic object permissions checker class being the heart of django-guardian.
Once checked for single object, permissions are stored and we don’t hit database again if another check is called for this object. This is great for templates, views or other request based checks (assuming we don’t have hundreds of permissions on a single object as we fetch all permissions for checked object).
On the other hand, if we call has_perm for perm1/object1, then we change permission state and call has_perm again for same perm1/object1 on same instance of ObjectPermissionChecker we won’t see a difference as permissions are already fetched and stored within cache dictionary.
|Parameters:||user_or_group – should be an User, AnonymousUser or Group instance|
Returns cache key for _obj_perms_cache dict.
Returns list of codename‘s of all permissions for given obj.
|Parameters:||obj – Django model instance for which permission should be checked|
Checks if user/group has given permission for object.