Backends¶
ObjectPermissionBackend¶
-
class
guardian.backends.ObjectPermissionBackend¶ -
get_all_permissions(user_obj, obj=None)¶ Returns a set of permission strings that the given
user_objhas forobj
-
has_perm(user_obj, perm, obj=None)¶ Returns
Trueif givenuser_objhaspermforobj. If noobjis given,Falseis returned.Note
Remember, that if user is not active, all checks would return
False.Main difference between Django’s
ModelBackendis that we can passobjinstance here andpermdoesn’t have to containapp_labelas it can be retrieved from givenobj.Inactive user support
If user is authenticated but inactive at the same time, all checks always returns
False.
-