101_Team_based_sharing #122
@ -141,7 +141,7 @@ class ShareModalForm(BaseModalForm):
|
||||
self.load_initial_data(form_data)
|
||||
|
||||
def save(self):
|
||||
self.instance.update_sharing_user(self)
|
||||
self.instance.update_shared_access(self)
|
||||
|
||||
|
||||
class NewRevocationModalForm(BaseModalForm):
|
||||
@ -290,7 +290,9 @@ class CheckModalForm(BaseModalForm):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
comps = self.instance.compensations.all()
|
||||
comps = self.instance.compensations.filter(
|
||||
deleted=None,
|
||||
)
|
||||
comps_valid = True
|
||||
for comp in comps:
|
||||
checker = comp.quality_check()
|
||||
|
@ -15,7 +15,10 @@ from django.db.models import QuerySet
|
||||
from konova.sub_settings.lanis_settings import DEFAULT_SRID_RLP, LANIS_ZOOM_LUT, LANIS_LINK_TEMPLATE
|
||||
from konova.tasks import celery_send_mail_shared_access_removed, celery_send_mail_shared_access_given, \
|
||||
celery_send_mail_shared_data_recorded, celery_send_mail_shared_data_unrecorded, \
|
||||
celery_send_mail_shared_data_deleted, celery_send_mail_shared_data_checked
|
||||
celery_send_mail_shared_data_deleted, celery_send_mail_shared_data_checked, \
|
||||
celery_send_mail_shared_access_given_team, celery_send_mail_shared_access_removed_team, \
|
||||
celery_send_mail_shared_data_checked_team, celery_send_mail_shared_data_deleted_team, \
|
||||
celery_send_mail_shared_data_unrecorded_team, celery_send_mail_shared_data_recorded_team
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.http import HttpRequest
|
||||
from django.utils.timezone import now
|
||||
@ -130,6 +133,11 @@ class BaseObject(BaseResource):
|
||||
for user_id in shared_users:
|
||||
celery_send_mail_shared_data_deleted.delay(self.identifier, self.title, user_id)
|
||||
|
||||
# Send mail
|
||||
shared_teams = self.shared_teams.values_list("id", flat=True)
|
||||
for team_id in shared_teams:
|
||||
celery_send_mail_shared_data_deleted_team.delay(self.identifier, self.title, team_id)
|
||||
|
||||
self.save()
|
||||
|
||||
def mark_as_edited(self, performing_user, request: HttpRequest = None, edit_comment: str = None):
|
||||
@ -258,10 +266,15 @@ class RecordableObjectMixin(models.Model):
|
||||
self.save()
|
||||
self.log.add(action)
|
||||
|
||||
shared_users = self.users.all().values_list("id", flat=True)
|
||||
shared_users = self.shared_users.values_list("id", flat=True)
|
||||
shared_teams = self.shared_teams.values_list("id", flat=True)
|
||||
|
||||
for user_id in shared_users:
|
||||
celery_send_mail_shared_data_unrecorded.delay(self.identifier, self.title, user_id)
|
||||
|
||||
for team_id in shared_teams:
|
||||
celery_send_mail_shared_data_unrecorded_team.delay(self.identifier, self.title, team_id)
|
||||
|
||||
return action
|
||||
|
||||
def set_recorded(self, user):
|
||||
@ -281,10 +294,15 @@ class RecordableObjectMixin(models.Model):
|
||||
self.save()
|
||||
self.log.add(action)
|
||||
|
||||
shared_users = self.users.all().values_list("id", flat=True)
|
||||
shared_users = self.shared_users.values_list("id", flat=True)
|
||||
shared_teams = self.shared_teams.values_list("id", flat=True)
|
||||
|
||||
for user_id in shared_users:
|
||||
celery_send_mail_shared_data_recorded.delay(self.identifier, self.title, user_id)
|
||||
|
||||
for team_id in shared_teams:
|
||||
celery_send_mail_shared_data_recorded_team.delay(self.identifier, self.title, team_id)
|
||||
|
||||
return action
|
||||
|
||||
def unrecord(self, performing_user, request: HttpRequest = None):
|
||||
@ -367,10 +385,15 @@ class CheckableObjectMixin(models.Model):
|
||||
self.save()
|
||||
|
||||
# Send mail
|
||||
shared_users = self.users.all().values_list("id", flat=True)
|
||||
shared_users = self.shared_users.values_list("id", flat=True)
|
||||
for user_id in shared_users:
|
||||
celery_send_mail_shared_data_checked.delay(self.identifier, self.title, user_id)
|
||||
|
||||
# Send mail
|
||||
shared_teams = self.shared_teams.values_list("id", flat=True)
|
||||
for team_id in shared_teams:
|
||||
celery_send_mail_shared_data_checked_team.delay(self.identifier, self.title, team_id)
|
||||
|
||||
self.log.add(action)
|
||||
return action
|
||||
|
||||
@ -488,8 +511,8 @@ class ShareableObjectMixin(models.Model):
|
||||
"""
|
||||
self.users.set(user_list)
|
||||
|
||||
def update_sharing_user(self, form):
|
||||
""" Adds a new user with shared access to the object
|
||||
def _update_shared_teams(self, form):
|
||||
""" Updates shared access on the object for teams
|
||||
|
||||
Args:
|
||||
form (ShareModalForm): The form holding the data
|
||||
@ -497,33 +520,46 @@ class ShareableObjectMixin(models.Model):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
from user.models import User
|
||||
form_data = form.cleaned_data
|
||||
shared_teams = self.shared_teams
|
||||
|
||||
# Fetch selected teams and find out which user IDs are in removed teams -> mails need to be sent
|
||||
accessing_teams = form_data["teams"]
|
||||
removed_team_users = self.teams.all().exclude(
|
||||
removed_teams = shared_teams.exclude(
|
||||
id__in=accessing_teams
|
||||
).values_list("users__id", flat=True)
|
||||
accessing_team_users = User.objects.filter(
|
||||
id__in=accessing_teams.values_list("users", flat=True)
|
||||
)
|
||||
new_team_users = accessing_team_users.exclude(
|
||||
id__in=self.shared_users
|
||||
).values_list("id", flat=True)
|
||||
new_teams = accessing_teams.exclude(
|
||||
id__in=shared_teams
|
||||
).values_list("id", flat=True)
|
||||
|
||||
for team_id in new_teams:
|
||||
celery_send_mail_shared_access_given_team.delay(self.identifier, self.title, team_id)
|
||||
for team_id in removed_teams:
|
||||
celery_send_mail_shared_access_removed_team.delay(self.identifier, self.title, team_id)
|
||||
|
||||
self.share_with_team_list(accessing_teams)
|
||||
|
||||
def _update_shared_users(self, form):
|
||||
""" Updates shared access on the object for single users
|
||||
|
||||
Args:
|
||||
form (ShareModalForm): The form holding the data
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
form_data = form.cleaned_data
|
||||
shared_users = self.shared_users
|
||||
|
||||
# Fetch selected users
|
||||
accessing_users = form_data["users"]
|
||||
removed_users = self.users.all().exclude(
|
||||
removed_users = shared_users.exclude(
|
||||
id__in=accessing_users
|
||||
).values_list("id", flat=True)
|
||||
new_users = accessing_users.exclude(
|
||||
id__in=self.shared_users
|
||||
id__in=shared_users
|
||||
).values_list("id", flat=True)
|
||||
|
||||
new_users = new_users.union(new_team_users)
|
||||
removed_users = removed_users.union(removed_team_users)
|
||||
|
||||
# Send mails
|
||||
for user_id in removed_users:
|
||||
celery_send_mail_shared_access_removed.delay(self.identifier, self.title, user_id)
|
||||
@ -532,7 +568,18 @@ class ShareableObjectMixin(models.Model):
|
||||
|
||||
# Set new shared users
|
||||
self.share_with_user_list(accessing_users)
|
||||
self.share_with_team_list(accessing_teams)
|
||||
|
||||
def update_shared_access(self, form):
|
||||
""" Updates shared access on the object
|
||||
|
||||
Args:
|
||||
form (ShareModalForm): The form holding the data
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
self._update_shared_teams(form)
|
||||
self._update_shared_users(form)
|
||||
|
||||
@property
|
||||
def shared_users(self) -> QuerySet:
|
||||
|
@ -38,6 +38,20 @@ def celery_send_mail_shared_access_given(obj_identifier, obj_title=None, user_id
|
||||
user.send_mail_shared_access_given(obj_identifier, obj_title)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_access_removed_team(obj_identifier, obj_title=None, team_id=None):
|
||||
from user.models import Team
|
||||
team = Team.objects.get(id=team_id)
|
||||
team.send_mail_shared_access_removed(obj_identifier, obj_title)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_access_given_team(obj_identifier, obj_title=None, team_id=None):
|
||||
from user.models import Team
|
||||
team = Team.objects.get(id=team_id)
|
||||
team.send_mail_shared_access_given_team(obj_identifier, obj_title)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_data_recorded(obj_identifier, obj_title=None, user_id=None):
|
||||
from user.models import User
|
||||
@ -52,6 +66,20 @@ def celery_send_mail_shared_data_unrecorded(obj_identifier, obj_title=None, user
|
||||
user.send_mail_shared_data_unrecorded(obj_identifier, obj_title)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_data_recorded_team(obj_identifier, obj_title=None, team_id=None):
|
||||
from user.models import Team
|
||||
team = Team.objects.get(id=team_id)
|
||||
team.send_mail_shared_data_recorded(obj_identifier, obj_title)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_data_unrecorded_team(obj_identifier, obj_title=None, team_id=None):
|
||||
from user.models import Team
|
||||
team = Team.objects.get(id=team_id)
|
||||
team.send_mail_shared_data_unrecorded(obj_identifier, obj_title)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_data_deleted(obj_identifier, obj_title=None, user_id=None):
|
||||
from user.models import User
|
||||
@ -64,3 +92,17 @@ def celery_send_mail_shared_data_checked(obj_identifier, obj_title=None, user_id
|
||||
from user.models import User
|
||||
user = User.objects.get(id=user_id)
|
||||
user.send_mail_shared_data_checked(obj_identifier, obj_title)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_data_deleted_team(obj_identifier, obj_title=None, team_id=None):
|
||||
from user.models import Team
|
||||
team = Team.objects.get(id=team_id)
|
||||
team.send_mail_shared_data_deleted(obj_identifier, obj_title)
|
||||
|
||||
|
||||
@shared_task
|
||||
def celery_send_mail_shared_data_checked_team(obj_identifier, obj_title=None, team_id=None):
|
||||
from user.models import Team
|
||||
team = Team.objects.get(id=team_id)
|
||||
team.send_mail_shared_data_checked(obj_identifier, obj_title)
|
||||
|
@ -92,6 +92,144 @@ class Mailer:
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_access_given_team(self, obj_identifier, obj_title, team):
|
||||
""" Send a mail if a team just got access to the object
|
||||
|
||||
Args:
|
||||
obj_identifier (str): The object identifier
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
context = {
|
||||
"team": team,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
msg = render_to_string("email/sharing/shared_access_given_team.html", context)
|
||||
user_mail_address = team.users.values_list("email", flat=True)
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared access given").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_access_removed_team(self, obj_identifier, obj_title, team):
|
||||
""" Send a mail if a team just lost access to the object
|
||||
|
||||
Args:
|
||||
obj_identifier (str): The object identifier
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
context = {
|
||||
"team": team,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
msg = render_to_string("email/sharing/shared_access_removed_team.html", context)
|
||||
user_mail_address = team.users.values_list("email", flat=True)
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared access removed").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_data_unrecorded_team(self, obj_identifier, obj_title, team):
|
||||
""" Send a mail if data has just been unrecorded
|
||||
|
||||
Args:
|
||||
obj_identifier (str): The object identifier
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
context = {
|
||||
"team": team,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
msg = render_to_string("email/recording/shared_data_unrecorded_team.html", context)
|
||||
user_mail_address = team.users.values_list("email", flat=True)
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared data unrecorded").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_data_recorded_team(self, obj_identifier, obj_title, team):
|
||||
""" Send a mail if data has just been recorded
|
||||
|
||||
Args:
|
||||
obj_identifier (str): The object identifier
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
context = {
|
||||
"team": team,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
msg = render_to_string("email/recording/shared_data_recorded_team.html", context)
|
||||
user_mail_address = team.users.values_list("email", flat=True)
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared data recorded").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_data_checked_team(self, obj_identifier, obj_title, team):
|
||||
""" Send a mail if data has just been checked
|
||||
|
||||
Args:
|
||||
obj_identifier (str): The object identifier
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
context = {
|
||||
"team": team,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
msg = render_to_string("email/checking/shared_data_checked_team.html", context)
|
||||
user_mail_address = team.users.values_list("email", flat=True)
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared data checked").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_data_deleted_team(self, obj_identifier, obj_title, team):
|
||||
""" Send a mail if data has just been deleted
|
||||
|
||||
Args:
|
||||
obj_identifier (str): The object identifier
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
context = {
|
||||
"team": team,
|
||||
"obj_identifier": obj_identifier,
|
||||
"obj_title": obj_title,
|
||||
"EMAIL_REPLY_TO": EMAIL_REPLY_TO,
|
||||
}
|
||||
msg = render_to_string("email/deleting/shared_data_deleted_team.html", context)
|
||||
user_mail_address = team.users.values_list("email", flat=True)
|
||||
self.send(
|
||||
user_mail_address,
|
||||
_("{} - Shared data deleted").format(obj_identifier),
|
||||
msg
|
||||
)
|
||||
|
||||
def send_mail_shared_data_recorded(self, obj_identifier, obj_title, user):
|
||||
""" Send a mail if the user's shared data has just been unrecorded
|
||||
|
||||
|
Binary file not shown.
@ -26,7 +26,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-02-18 14:01+0100\n"
|
||||
"POT-Creation-Date: 2022-02-18 14:50+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -1796,27 +1796,27 @@ msgstr "In Zwischenablage kopiert"
|
||||
msgid "{} - Shared access removed"
|
||||
msgstr "{} - Zugriff entzogen"
|
||||
|
||||
#: konova/utils/mailer.py:91
|
||||
#: konova/utils/mailer.py:91 konova/utils/mailer.py:114
|
||||
msgid "{} - Shared access given"
|
||||
msgstr "{} - Zugriff freigegeben"
|
||||
|
||||
#: konova/utils/mailer.py:114
|
||||
#: konova/utils/mailer.py:137
|
||||
msgid "{} - Shared data recorded"
|
||||
msgstr "{} - Freigegebene Daten verzeichnet"
|
||||
|
||||
#: konova/utils/mailer.py:137
|
||||
#: konova/utils/mailer.py:160
|
||||
msgid "{} - Shared data unrecorded"
|
||||
msgstr "{} - Freigegebene Daten entzeichnet"
|
||||
|
||||
#: konova/utils/mailer.py:160
|
||||
#: konova/utils/mailer.py:183
|
||||
msgid "{} - Shared data deleted"
|
||||
msgstr "{} - Freigegebene Daten gelöscht"
|
||||
|
||||
#: konova/utils/mailer.py:183
|
||||
#: konova/utils/mailer.py:206
|
||||
msgid "{} - Shared data checked"
|
||||
msgstr "{} - Freigegebene Daten geprüft"
|
||||
|
||||
#: konova/utils/mailer.py:204 templates/email/api/verify_token.html:4
|
||||
#: konova/utils/mailer.py:227 templates/email/api/verify_token.html:4
|
||||
msgid "Request for new API token"
|
||||
msgstr "Anfrage für neuen API Token"
|
||||
|
||||
@ -2092,7 +2092,9 @@ msgstr ""
|
||||
#: templates/email/recording/shared_data_recorded.html:19
|
||||
#: templates/email/recording/shared_data_unrecorded.html:19
|
||||
#: templates/email/sharing/shared_access_given.html:20
|
||||
#: templates/email/sharing/shared_access_given_team.html:20
|
||||
#: templates/email/sharing/shared_access_removed.html:20
|
||||
#: templates/email/sharing/shared_access_removed_team.html:20
|
||||
msgid "Best regards"
|
||||
msgstr "Beste Grüße"
|
||||
|
||||
@ -2179,6 +2181,7 @@ msgstr ""
|
||||
"zugehörigen Kompensationen automatisch entzeichnet worden sind."
|
||||
|
||||
#: templates/email/sharing/shared_access_given.html:4
|
||||
#: templates/email/sharing/shared_access_given_team.html:4
|
||||
msgid "Access shared"
|
||||
msgstr "Zugriff freigegeben"
|
||||
|
||||
@ -2187,10 +2190,12 @@ msgid "the following dataset has just been shared with you"
|
||||
msgstr "der folgende Datensatz wurde soeben für Sie freigegeben "
|
||||
|
||||
#: templates/email/sharing/shared_access_given.html:16
|
||||
#: templates/email/sharing/shared_access_given_team.html:16
|
||||
msgid "This means you can now edit this dataset."
|
||||
msgstr "Das bedeutet, dass Sie diesen Datensatz nun auch bearbeiten können."
|
||||
|
||||
#: templates/email/sharing/shared_access_given.html:17
|
||||
#: templates/email/sharing/shared_access_given_team.html:17
|
||||
msgid ""
|
||||
"The shared dataset appears now by default on your overview for this dataset "
|
||||
"type."
|
||||
@ -2199,6 +2204,7 @@ msgstr ""
|
||||
"Datensatztyp im KSP gelistet."
|
||||
|
||||
#: templates/email/sharing/shared_access_given.html:27
|
||||
#: templates/email/sharing/shared_access_given_team.html:27
|
||||
msgid ""
|
||||
"Please note: Shared access on an intervention means you automatically have "
|
||||
"editing access to related compensations."
|
||||
@ -2207,7 +2213,17 @@ msgstr ""
|
||||
"Sie automatisch auch Zugriff auf die zugehörigen Kompensationen erhalten "
|
||||
"haben."
|
||||
|
||||
#: templates/email/sharing/shared_access_given_team.html:8
|
||||
#: templates/email/sharing/shared_access_removed_team.html:8
|
||||
msgid "Hello team"
|
||||
msgstr "Hallo Team"
|
||||
|
||||
#: templates/email/sharing/shared_access_given_team.html:10
|
||||
msgid "the following dataset has just been shared with your team"
|
||||
msgstr "der folgende Datensatz wurde soeben für Ihr Team freigegeben "
|
||||
|
||||
#: templates/email/sharing/shared_access_removed.html:4
|
||||
#: templates/email/sharing/shared_access_removed_team.html:4
|
||||
msgid "Shared access removed"
|
||||
msgstr "Freigegebener Zugriff entzogen"
|
||||
|
||||
@ -2219,10 +2235,12 @@ msgstr ""
|
||||
"entzogen: "
|
||||
|
||||
#: templates/email/sharing/shared_access_removed.html:16
|
||||
#: templates/email/sharing/shared_access_removed_team.html:16
|
||||
msgid "However, you are still able to view the dataset content."
|
||||
msgstr "Sie können den Datensatz aber immer noch im KSP einsehen."
|
||||
|
||||
#: templates/email/sharing/shared_access_removed.html:17
|
||||
#: templates/email/sharing/shared_access_removed_team.html:17
|
||||
msgid ""
|
||||
"Please use the provided search filter on the dataset`s overview pages to "
|
||||
"find them."
|
||||
@ -2230,6 +2248,14 @@ msgstr ""
|
||||
"Nutzen Sie hierzu einfach die entsprechenden Suchfilter auf den "
|
||||
"Übersichtsseiten"
|
||||
|
||||
#: templates/email/sharing/shared_access_removed_team.html:10
|
||||
msgid ""
|
||||
"your teams shared access, including editing, has been revoked for the "
|
||||
"dataset "
|
||||
msgstr ""
|
||||
"Ihrem Team wurde soeben der bearbeitende Zugriff auf den folgenden Datensatz "
|
||||
"entzogen: "
|
||||
|
||||
#: templates/email/signature.html:6
|
||||
msgid "Please do not reply on this mail."
|
||||
msgstr "Bitte antworten Sie nicht auf diese Mail."
|
||||
@ -4118,6 +4144,9 @@ msgstr ""
|
||||
msgid "Unable to connect to qpid with SASL mechanism %s"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "your teams"
|
||||
#~ msgstr "Team entfernen"
|
||||
|
||||
#~ msgid "Remove check to remove access for this user"
|
||||
#~ msgstr "Wählen Sie die Nutzer ab, die keinen Zugriff mehr haben sollen"
|
||||
|
||||
|
28
templates/email/checking/shared_data_checked_team.html
Normal file
28
templates/email/checking/shared_data_checked_team.html
Normal file
@ -0,0 +1,28 @@
|
||||
{% load i18n %}
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Shared data checked' %}</h2>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello team' %} {{team.name}},
|
||||
<br>
|
||||
{% trans 'the following dataset has just been checked' %}
|
||||
<br>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>{{obj_title}}</strong>
|
||||
<br>
|
||||
{% trans 'This means, the responsible registration office just confirmed the correctness of this dataset.' %}
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'Best regards' %}
|
||||
<br>
|
||||
KSP
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
{% include 'email/signature.html' %}
|
||||
</article>
|
||||
</div>
|
||||
|
28
templates/email/deleting/shared_data_deleted_team.html
Normal file
28
templates/email/deleting/shared_data_deleted_team.html
Normal file
@ -0,0 +1,28 @@
|
||||
{% load i18n %}
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Shared data deleted' %}</h2>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello team' %} {{team.name}},
|
||||
<br>
|
||||
{% trans 'the following dataset has just been deleted' %}
|
||||
<br>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
{% trans 'If this should not have been happened, please contact us. See the signature for details.' %}
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'Best regards' %}
|
||||
<br>
|
||||
KSP
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
{% include 'email/signature.html' %}
|
||||
</article>
|
||||
</div>
|
||||
|
33
templates/email/recording/shared_data_recorded_team.html
Normal file
33
templates/email/recording/shared_data_recorded_team.html
Normal file
@ -0,0 +1,33 @@
|
||||
{% load i18n %}
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Shared data recorded' %}</h2>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello team' %} {{team.name}},
|
||||
<br>
|
||||
{% trans 'the following dataset has just been recorded' %}
|
||||
<br>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
{% trans 'This means the data is now publicly available, e.g. in LANIS' %}
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'Best regards' %}
|
||||
<br>
|
||||
KSP
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<small>
|
||||
{% trans 'Please note: Recorded intervention means the compensations are recorded as well.' %}
|
||||
</small>
|
||||
<br>
|
||||
<br>
|
||||
{% include 'email/signature.html' %}
|
||||
</article>
|
||||
</div>
|
||||
|
33
templates/email/recording/shared_data_unrecorded_team.html
Normal file
33
templates/email/recording/shared_data_unrecorded_team.html
Normal file
@ -0,0 +1,33 @@
|
||||
{% load i18n %}
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Shared data unrecorded' %}</h2>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello team' %} {{team.name}},
|
||||
<br>
|
||||
{% trans 'the following dataset has just been unrecorded' %}
|
||||
<br>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
{% trans 'This means the data is no longer publicly available.' %}
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'Best regards' %}
|
||||
<br>
|
||||
KSP
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<small>
|
||||
{% trans 'Please note: Unrecorded intervention means the compensations are unrecorded as well.' %}
|
||||
</small>
|
||||
<br>
|
||||
<br>
|
||||
{% include 'email/signature.html' %}
|
||||
</article>
|
||||
</div>
|
||||
|
34
templates/email/sharing/shared_access_given_team.html
Normal file
34
templates/email/sharing/shared_access_given_team.html
Normal file
@ -0,0 +1,34 @@
|
||||
{% load i18n %}
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Access shared' %}</h2>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello team' %} {{team.name}},
|
||||
<br>
|
||||
{% trans 'the following dataset has just been shared with your team' %}
|
||||
<br>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
{% trans 'This means you can now edit this dataset.' %}
|
||||
{% trans 'The shared dataset appears now by default on your overview for this dataset type.' %}
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'Best regards' %}
|
||||
<br>
|
||||
KSP
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<small>
|
||||
{% trans 'Please note: Shared access on an intervention means you automatically have editing access to related compensations.' %}
|
||||
</small>
|
||||
<br>
|
||||
<br>
|
||||
{% include 'email/signature.html' %}
|
||||
</article>
|
||||
</div>
|
||||
|
29
templates/email/sharing/shared_access_removed_team.html
Normal file
29
templates/email/sharing/shared_access_removed_team.html
Normal file
@ -0,0 +1,29 @@
|
||||
{% load i18n %}
|
||||
|
||||
<div>
|
||||
<h2>{% trans 'Shared access removed' %}</h2>
|
||||
<h4>{{obj_identifier}}</h4>
|
||||
<hr>
|
||||
<article>
|
||||
{% trans 'Hello team' %} {{team.name}},
|
||||
<br>
|
||||
{% trans 'your teams shared access, including editing, has been revoked for the dataset ' %}
|
||||
<br>
|
||||
<strong>{{obj_identifier}}</strong>
|
||||
<br>
|
||||
<strong>"{{obj_title}}"</strong>
|
||||
<br>
|
||||
{% trans 'However, you are still able to view the dataset content.' %}
|
||||
{% trans 'Please use the provided search filter on the dataset`s overview pages to find them.' %}
|
||||
<br>
|
||||
<br>
|
||||
{% trans 'Best regards' %}
|
||||
<br>
|
||||
KSP
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
{% include 'email/signature.html' %}
|
||||
</article>
|
||||
</div>
|
||||
|
@ -1,6 +1,7 @@
|
||||
from django.db import models
|
||||
|
||||
from konova.models import UuidModel
|
||||
from konova.utils.mailer import Mailer
|
||||
|
||||
|
||||
class Team(UuidModel):
|
||||
@ -14,3 +15,81 @@ class Team(UuidModel):
|
||||
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user