Changes for sqlalchemy 2.0

This commit is contained in:
Aditi Anand
2024-04-24 16:27:20 -04:00
parent df2a590f1a
commit ad55eef5e9
14 changed files with 160 additions and 166 deletions

View File

@@ -6,6 +6,7 @@ from urllib.parse import urlencode
from flask import Blueprint, abort, current_app, jsonify, request
from notifications_utils.recipients import is_us_phone_number, use_numeric_sender
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm.exc import NoResultFound
from app import redis_store
from app.config import QueueNames
@@ -533,6 +534,12 @@ def set_permissions(user_id, service_id):
# TODO fix security hole, how do we verify that the user
# who is making this request has permission to make the request.
service_user = dao_get_service_user(user_id, service_id)
# TODO: Below exception is raised to account for the test case failure that got handled
# on its own in 1.4 when dao_get_service_user() returned an excpetion in case no result was found
if service_user is None:
raise NoResultFound(
"No ServiceUser found with the provided user_id and service_id"
)
user = get_user_by_id(user_id)
service = dao_fetch_service_by_id(service_id=service_id)