mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
add new key_type table
* single-column static data table that currently contains two types: 'normal' and 'team' * key_type foreign-keyed from api_keys - must be not null - existing rows set to 'normal' * key_type foreign-keyed from notifications - nullable - existing rows set to null * api_key foreign-keyed from notifications - nullable - existing rows set to null
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import uuid
|
||||
from flask import current_app
|
||||
from notifications_python_client.authentication import create_jwt_token
|
||||
from app.models import ApiKey
|
||||
from app.models import ApiKey, KEY_TYPE_NORMAL
|
||||
from app.dao.api_key_dao import (get_unsigned_secrets, save_model_api_key)
|
||||
from app.dao.services_dao import dao_fetch_service_by_id
|
||||
|
||||
@@ -14,7 +14,12 @@ def create_authorization_header(service_id=None):
|
||||
secret = secrets[0]
|
||||
else:
|
||||
service = dao_fetch_service_by_id(service_id)
|
||||
data = {'service': service, 'name': uuid.uuid4(), 'created_by': service.created_by}
|
||||
data = {
|
||||
'service': service,
|
||||
'name': uuid.uuid4(),
|
||||
'created_by': service.created_by,
|
||||
'key_type': KEY_TYPE_NORMAL
|
||||
}
|
||||
api_key = ApiKey(**data)
|
||||
save_model_api_key(api_key)
|
||||
secret = get_unsigned_secrets(service_id)[0]
|
||||
|
||||
Reference in New Issue
Block a user