#31 API WIP
* adds support for GET /check on intervention to run checks automatically via API
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user