mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
add filters to GET /notifications endpoints to only return for provided key_type
if api_key used to access endpoint is type team, endpoints only return that type - will 404 if you provide a different ID. Same applies for normal (normal api keys cannot see team notifications) also, for convenience, set sample_notification to supply key_type of KEY_TYPE_NORMAL by default
This commit is contained in:
@@ -171,7 +171,9 @@ def process_firetext_response():
|
||||
|
||||
@notifications.route('/notifications/<uuid:notification_id>', methods=['GET'])
|
||||
def get_notifications(notification_id):
|
||||
notification = notifications_dao.get_notification(str(api_user.service_id), notification_id)
|
||||
notification = notifications_dao.get_notification(str(api_user.service_id),
|
||||
notification_id,
|
||||
key_type=api_user.key_type)
|
||||
return jsonify(data={"notification": notification_status_schema.dump(notification).data}), 200
|
||||
|
||||
|
||||
@@ -187,7 +189,8 @@ def get_all_notifications():
|
||||
filter_dict=data,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
limit_days=limit_days)
|
||||
limit_days=limit_days,
|
||||
key_type=api_user.key_type)
|
||||
return jsonify(
|
||||
notifications=notification_status_schema.dump(pagination.items, many=True).data,
|
||||
page_size=page_size,
|
||||
|
||||
Reference in New Issue
Block a user