feat: audit log of admin writes, sign-ins and key creation, with an audit tab [CI]

This commit is contained in:
justme committed 2026-10-07 22:17:52 +08:00
1 parent 359313a57b
commit 1379b8c7cb
21 files changed
+579 -7

No files matched your search

+168
View File
@@ -3598,6 +3598,93 @@
"x-moshiro-capability": "data.write"
}
},
"/api/admin/audit": {
"get": {
"tags": [
"admin-audit"
],
"summary": "Audit log of admin actions, newest first",
"operationId": "audit_list",
"parameters": [
{
"name": "actor",
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "action",
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "limit",
"in": "query",
"schema": {
"pattern": "^-?(?:0|[1-9]\\d*)$",
"type": [
"integer",
"string"
],
"format": "int32"
}
},
{
"name": "cursor",
"in": "query",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PageDtoOfAuditDto"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDto"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDto"
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDto"
}
}
}
}
},
"x-moshiro-capability": "audit.read"
}
},
"/api/admin/api-tokens": {
"get": {
"tags": [
@@ -4938,6 +5025,63 @@
}
}
},
"AuditDto": {
"required": [
"id",
"at",
"actor",
"method",
"action",
"target",
"detail",
"remote",
"success"
],
"type": "object",
"properties": {
"id": {
"pattern": "^-?(?:0|[1-9]\\d*)$",
"type": [
"integer",
"string"
],
"format": "int64"
},
"at": {
"format": "date-time"
},
"actor": {
"type": "string"
},
"method": {
"type": "string"
},
"action": {
"type": "string"
},
"target": {
"type": [
"null",
"string"
]
},
"detail": {
"type": [
"null",
"string"
]
},
"remote": {
"type": [
"null",
"string"
]
},
"success": {
"type": "boolean"
}
}
},
"BackendUpdateDto": {
"required": [
"channel",
@@ -6982,6 +7126,27 @@
}
}
},
"PageDtoOfAuditDto": {
"required": [
"items",
"next_cursor"
],
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/components/schemas/AuditDto"
}
},
"next_cursor": {
"type": [
"null",
"string"
]
}
}
},
"PageDtoOfEventDto": {
"required": [
"items",
@@ -8623,6 +8788,9 @@
{
"name": "admin-data"
},
{
"name": "admin-audit"
},
{
"name": "admin-api-tokens"
},