* adds support for GET /check on intervention to run checks automatically via API
This commit is contained in:
2022-01-25 09:29:14 +01:00
parent 096688fad5
commit 0b723b1529
8 changed files with 132 additions and 35 deletions

View File

@@ -9,6 +9,7 @@ from django.contrib.auth.models import AbstractUser
from django.db import models
from konova.settings import ZB_GROUP, DEFAULT_GROUP, ETS_GROUP
from konova.utils.mailer import Mailer
from user.enums import UserNotificationEnum
@@ -28,6 +29,36 @@ class User(AbstractUser):
id=notification_enum.value
).exists()
def is_zb_user(self):
""" Shortcut for checking whether a user is of a special group or not
Returns:
bool
"""
return self.groups.filter(
name=ZB_GROUP
).exists()
def is_default_user(self):
""" Shortcut for checking whether a user is of a special group or not
Returns:
bool
"""
return self.groups.filter(
name=DEFAULT_GROUP
).exists()
def is_ets_user(self):
""" Shortcut for checking whether a user is of a special group or not
Returns:
bool
"""
return self.groups.filter(
name=ETS_GROUP
).exists()
def send_mail_shared_access_removed(self, obj_identifier):
""" Sends a mail to the user in case of removed shared access