Skip to content

Commit

Permalink
Add group constants
Browse files Browse the repository at this point in the history
  • Loading branch information
WillNilges committed Dec 22, 2023
1 parent ddcd605 commit a3f829e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/meshapi/permissions.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
from django.contrib.auth import PermissionDenied
from rest_framework import permissions

INSTALLER_GROUP="Installer"
ADMIN_GROUP="Admin"
READONLY_GROUP="ReadOnly"

def is_installer(user):
return user.groups.filter(name="Installer").exists()
return user.groups.filter(name=INSTALLER_GROUP).exists()


def is_admin(user):
return user.groups.filter(name="Admin").exists()
return user.groups.filter(name=ADMIN_GROUP).exists()


def is_readonly(user):
return user.groups.filter(name="ReadOnly").exists()
return user.groups.filter(name=READONLY_GROUP).exists()


perm_denied_generic_msg = "You do not have access to this resource."
Expand Down

0 comments on commit a3f829e

Please sign in to comment.