mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 17:01:35 -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:
@@ -323,7 +323,9 @@ def sample_notification(notify_db,
|
||||
created_at=datetime.utcnow(),
|
||||
content_char_count=160,
|
||||
create=True,
|
||||
personalisation=None):
|
||||
personalisation=None,
|
||||
api_key_id=None,
|
||||
key_type=KEY_TYPE_NORMAL):
|
||||
if service is None:
|
||||
service = sample_service(notify_db, notify_db_session)
|
||||
if template is None:
|
||||
@@ -352,7 +354,9 @@ def sample_notification(notify_db,
|
||||
'created_at': created_at,
|
||||
'content_char_count': content_char_count,
|
||||
'personalisation': personalisation,
|
||||
'notification_type': template.template_type
|
||||
'notification_type': template.template_type,
|
||||
'api_key_id': api_key_id,
|
||||
'key_type': key_type
|
||||
}
|
||||
if job_row_number:
|
||||
data['job_row_number'] = job_row_number
|
||||
|
||||
Reference in New Issue
Block a user