Skip to content

Commit 3287c11

Browse files
authored
Create PermissionsMixin.py
1 parent 1a29826 commit 3287c11

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

PermissionsMixin.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
is_superuser
2+
Boolean. Designates that this user has all permissions without explicitly assigning them.
3+
4+
get_group_permissions(obj=None)
5+
Returns a set of permission strings that the user has, through their groups.
6+
7+
If obj is passed in, only returns the group permissions for this specific object.
8+
9+
get_all_permissions(obj=None)
10+
Returns a set of permission strings that the user has, both through group and user permissions.
11+
12+
If obj is passed in, only returns the permissions for this specific object.
13+
14+
has_perm(perm, obj=None)
15+
Returns True if the user has the specified permission, where perm is in the format "<app label>.<permission codename>" (see permissions). If the user is inactive, this method will always return False.
16+
17+
If obj is passed in, this method wont check for a permission for the model, but for this specific object.
18+
19+
has_perms(perm_list, obj=None)
20+
Returns True if the user has each of the specified permissions, where each perm is in the format "<app label>.<permission codename>". If the user is inactive, this method will always return False.
21+
22+
If obj is passed in, this method wont check for permissions for the model, but for the specific object.
23+
24+
has_module_perms(package_name)
25+
Returns True if the user has any permissions in the given package (the Django app label). If the user is inactive, this method will always return False.
26+

0 commit comments

Comments
 (0)