forked from HHS/TANF-app
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb51a68
commit 2963c1f
Showing
7 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
tdrs-backend/tdpservice/email/templates/system-admin-role-changed.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{% extends 'base.html' %} | ||
{% block content %} | ||
<!-- Body copy --> | ||
<p style="color: #000000;"> | ||
|
||
<p>The following user account for the TANF Data Portal (TDP) has been deactivated.</p> | ||
|
||
<p>Account Information:</p> | ||
<ul> | ||
<li>Name: {{ user.first_name }}</li> | ||
<li>Last name: {{ user.last_name }}</li> | ||
<li>Email: {{ user.email }}</li> | ||
</ul> | ||
|
||
<p>Thank you,</p> | ||
TDP Team | ||
</p> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from django.db.models.signals import m2m_changed | ||
from django.dispatch import receiver | ||
from tdpservice.users.models import User | ||
from django.contrib.auth.models import Group | ||
from tdpservice.email.helpers.admin_notifications import email_system_owner_system_admin_role_change | ||
|
||
import logging | ||
logger = logging.getLogger() | ||
|
||
@receiver(m2m_changed, sender=User.groups.through) | ||
def user_group_changed(sender, instance, action, pk_set, **kwargs): | ||
ADMIN_GROUP_PK = Group.objects.get(name="OFA System Admin").pk | ||
ACTIONS = { | ||
'PRE_REMOVE' : 'pre_remove', | ||
'PRE_ADD' : 'pre_add', | ||
} | ||
group_change_list = [pk for pk in pk_set] | ||
if ADMIN_GROUP_PK in group_change_list and action == ACTIONS['PRE_ADD']: | ||
# EMAIL ADMIN GROUP ADDED to OFA ADMIN | ||
email_system_owner_system_admin_role_change(instance) | ||
elif ADMIN_GROUP_PK in group_change_list and action == ACTIONS['PRE_REMOVE']: | ||
# EMAIL ADMIN GROUP REMOVED from OFA ADMIN | ||
email_system_owner_system_admin_role_change(instance) |