KeyType implemented.

Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
Cliff Hill
2024-01-18 10:28:50 -05:00
parent db3761609b
commit 7416de2a28
20 changed files with 90 additions and 109 deletions

View File

@@ -3,8 +3,8 @@ import itertools
from notifications_utils.recipients import allowed_to_send_to
from app.dao.services_dao import dao_fetch_service_by_id
from app.enums import RecipientType
from app.models import KEY_TYPE_NORMAL, KEY_TYPE_TEAM, KEY_TYPE_TEST, ServiceGuestList
from app.enums import RecipientType, KeyType
from app.models import ServiceGuestList
def get_recipients_from_request(request_json, key, type):
@@ -28,10 +28,10 @@ def get_guest_list_objects(service_id, request_json):
def service_allowed_to_send_to(
recipient, service, key_type, allow_guest_list_recipients=True
):
if key_type == KEY_TYPE_TEST:
if key_type == KeyType.TEST:
return True
if key_type == KEY_TYPE_NORMAL and not service.restricted:
if key_type == KeyType.NORMAL and not service.restricted:
return True
# Revert back to the ORM model here so we can get some things which
@@ -45,8 +45,8 @@ def service_allowed_to_send_to(
member.recipient for member in service.guest_list if allow_guest_list_recipients
]
if (key_type == KEY_TYPE_NORMAL and service.restricted) or (
key_type == KEY_TYPE_TEAM
if (key_type == KeyType.NORMAL and service.restricted) or (
key_type == KeyType.TEAM
):
return allowed_to_send_to(
recipient, itertools.chain(team_members, guest_list_members)