events: rename context.token to context.secret
This commit is contained in:
parent
71c9108f89
commit
a7d0a50859
|
@ -49,5 +49,7 @@ class TokenViewSet(ModelViewSet):
|
||||||
if not tokens.exists():
|
if not tokens.exists():
|
||||||
raise Http404
|
raise Http404
|
||||||
token = tokens.first()
|
token = tokens.first()
|
||||||
Event.new(EventAction.SECRET_VIEW, token=token).from_http(request)
|
Event.new( # noqa # nosec
|
||||||
|
EventAction.SECRET_VIEW, secret=token
|
||||||
|
).from_http(request)
|
||||||
return Response(TokenViewSerializer({"key": token.key}).data)
|
return Response(TokenViewSerializer({"key": token.key}).data)
|
||||||
|
|
|
@ -10,9 +10,13 @@ def token_view_to_secret_view(apps: Apps, schema_editor: BaseDatabaseSchemaEdito
|
||||||
db_alias = schema_editor.connection.alias
|
db_alias = schema_editor.connection.alias
|
||||||
Event = apps.get_model("authentik_events", "Event")
|
Event = apps.get_model("authentik_events", "Event")
|
||||||
|
|
||||||
Event.objects.using(db_alias).filter(action="token_view").update(
|
events = Event.objects.using(db_alias).filter(action="token_view")
|
||||||
action=EventAction.SECRET_VIEW
|
|
||||||
)
|
for event in events:
|
||||||
|
event.context["secret"] = event.context.pop("token")
|
||||||
|
event.action = EventAction.SECRET_VIEW
|
||||||
|
|
||||||
|
Event.objects.using(db_alias).bulk_update(events, ["context", "action"])
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -91,8 +91,8 @@ export class EventInfo extends LitElement {
|
||||||
<ak-expand>${this.defaultResponse()}</ak-expand>`;
|
<ak-expand>${this.defaultResponse()}</ak-expand>`;
|
||||||
case "secret_view":
|
case "secret_view":
|
||||||
return html`
|
return html`
|
||||||
<h3>${gettext("Token:")}</h3>
|
<h3>${gettext("Secret:")}</h3>
|
||||||
${this.getModelInfo(this.event.context.token as EventContext)}`;
|
${this.getModelInfo(this.event.context.secret as EventContext)}`;
|
||||||
case "property_mapping_exception":
|
case "property_mapping_exception":
|
||||||
return html`<div class="pf-l-flex">
|
return html`<div class="pf-l-flex">
|
||||||
<div class="pf-l-flex__item">
|
<div class="pf-l-flex__item">
|
||||||
|
|
Reference in a new issue