mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 15:31:15 -05:00
more debug
This commit is contained in:
@@ -102,7 +102,7 @@ from app.service.service_senders_schema import (
|
||||
)
|
||||
from app.service.utils import get_guest_list_objects
|
||||
from app.user.users_schema import post_set_permissions_schema
|
||||
from app.utils import get_prev_next_pagination_links
|
||||
from app.utils import get_prev_next_pagination_links, hilite
|
||||
|
||||
service_blueprint = Blueprint("service", __name__)
|
||||
|
||||
@@ -314,7 +314,9 @@ def get_users_for_service(service_id):
|
||||
def add_user_to_service(service_id, user_id):
|
||||
service = dao_fetch_service_by_id(service_id)
|
||||
user = get_user_by_id(user_id=user_id)
|
||||
|
||||
# TODO REMOVE DEBUG
|
||||
print(hilite(f"GOING TO ADD {user.name} to service {service.name}"))
|
||||
# END DEBUG
|
||||
if user in service.users:
|
||||
error = "User id: {} already part of service id: {}".format(user_id, service_id)
|
||||
raise InvalidRequest(error, status_code=400)
|
||||
@@ -322,6 +324,7 @@ def add_user_to_service(service_id, user_id):
|
||||
data = request.get_json()
|
||||
validate(data, post_set_permissions_schema)
|
||||
|
||||
|
||||
permissions = [
|
||||
Permission(service_id=service_id, user_id=user_id, permission=p["permission"])
|
||||
for p in data["permissions"]
|
||||
@@ -329,6 +332,10 @@ def add_user_to_service(service_id, user_id):
|
||||
folder_permissions = data.get("folder_permissions", [])
|
||||
|
||||
dao_add_user_to_service(service, user, permissions, folder_permissions)
|
||||
# TODO REMOVE DEBUG
|
||||
print(hilite(f"ADDED {user.name} to service {service.name}"))
|
||||
# END DEBUG
|
||||
|
||||
data = service_schema.dump(service)
|
||||
return jsonify(data=data), 201
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import json
|
||||
import os
|
||||
from datetime import datetime
|
||||
|
||||
from app.utils import hilite
|
||||
from flask import Blueprint, current_app, jsonify, request
|
||||
from itsdangerous import BadData, SignatureExpired
|
||||
from notifications_utils.url_safe_token import check_token, generate_token
|
||||
@@ -32,6 +33,10 @@ register_errors(service_invite)
|
||||
|
||||
|
||||
def _create_service_invite(invited_user, invite_link_host):
|
||||
# TODO REMOVE DEBUG
|
||||
print(hilite("ENTER _create_service_invite"))
|
||||
# END DEBUG
|
||||
|
||||
template_id = current_app.config["INVITATION_EMAIL_TEMPLATE_ID"]
|
||||
|
||||
template = dao_get_template_by_id(template_id)
|
||||
@@ -85,11 +90,15 @@ def _create_service_invite(invited_user, invite_link_host):
|
||||
|
||||
# This is for the login.gov service invite on the
|
||||
# "Set Up Your Profile" path.
|
||||
redis_key = f"service-invite-{invited_user.email_address}"
|
||||
redis_store.set(
|
||||
f"service-invite-{invited_user.email_address}",
|
||||
redis_key,
|
||||
json.dumps(data),
|
||||
ex=3600 * 24,
|
||||
)
|
||||
# TODO REMOVE DEBUG
|
||||
print(hilite(f"Save this data {data} with this redis_key {redis_key}"))
|
||||
# END DEBUG
|
||||
send_notification_to_queue(saved_notification, queue=QueueNames.NOTIFY)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user