mpeltriaux
963854652e
* adds mail templates for shared data actions * fixes bug where deleted compensations would be used for checking
96 lines
2.7 KiB
Python
96 lines
2.7 KiB
Python
from django.db import models
|
|
|
|
from konova.models import UuidModel
|
|
from konova.utils.mailer import Mailer
|
|
|
|
|
|
class Team(UuidModel):
|
|
""" Groups users in self managed teams. Can be used for multi-sharing of data
|
|
|
|
"""
|
|
name = models.CharField(max_length=500, null=True, blank=True)
|
|
description = models.TextField(null=True, blank=True)
|
|
users = models.ManyToManyField("user.User", blank=True, related_name="teams")
|
|
admin = models.ForeignKey("user.User", blank=True, null=True, related_name="+", on_delete=models.SET_NULL)
|
|
|
|
def __str__(self):
|
|
return self.name
|
|
|
|
def send_mail_shared_access_given_team(self, obj_identifier, obj_title):
|
|
""" Sends a mail to the team members in case of given shared access
|
|
|
|
Args:
|
|
obj_identifier ():
|
|
obj_title ():
|
|
|
|
Returns:
|
|
|
|
"""
|
|
mailer = Mailer()
|
|
mailer.send_mail_shared_access_given_team(obj_identifier, obj_title, self)
|
|
|
|
def send_mail_shared_access_removed(self, obj_identifier, obj_title):
|
|
""" Sends a mail to the team members in case of removed shared access
|
|
|
|
Args:
|
|
obj_identifier ():
|
|
obj_title ():
|
|
|
|
Returns:
|
|
|
|
"""
|
|
mailer = Mailer()
|
|
mailer.send_mail_shared_access_removed_team(obj_identifier, obj_title, self)
|
|
|
|
def send_mail_shared_data_unrecorded(self, obj_identifier, obj_title):
|
|
""" Sends a mail to the team members in case of unrecorded data
|
|
|
|
Args:
|
|
obj_identifier ():
|
|
obj_title ():
|
|
|
|
Returns:
|
|
|
|
"""
|
|
mailer = Mailer()
|
|
mailer.send_mail_shared_data_unrecorded_team(obj_identifier, obj_title, self)
|
|
|
|
def send_mail_shared_data_recorded(self, obj_identifier, obj_title):
|
|
""" Sends a mail to the team members in case of unrecorded data
|
|
|
|
Args:
|
|
obj_identifier ():
|
|
obj_title ():
|
|
|
|
Returns:
|
|
|
|
"""
|
|
mailer = Mailer()
|
|
mailer.send_mail_shared_data_recorded_team(obj_identifier, obj_title, self)
|
|
|
|
def send_mail_shared_data_checked(self, obj_identifier, obj_title):
|
|
""" Sends a mail to the team members in case of checked data
|
|
|
|
Args:
|
|
obj_identifier ():
|
|
obj_title ():
|
|
|
|
Returns:
|
|
|
|
"""
|
|
mailer = Mailer()
|
|
mailer.send_mail_shared_data_checked_team(obj_identifier, obj_title, self)
|
|
|
|
def send_mail_shared_data_deleted(self, obj_identifier, obj_title):
|
|
""" Sends a mail to the team members in case of deleted data
|
|
|
|
Args:
|
|
obj_identifier ():
|
|
obj_title ():
|
|
|
|
Returns:
|
|
|
|
"""
|
|
mailer = Mailer()
|
|
mailer.send_mail_shared_data_deleted_team(obj_identifier, obj_title, self)
|