mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 06:52:06 -05:00
Changes for sqlalchemy 2.0
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user