Add ACL endpoints for managing access control lists and client information

This commit is contained in:
Lloyd
2025-12-18 12:22:01 +00:00
parent c08d72a247
commit 8ee83d70c7
2 changed files with 138 additions and 2 deletions
+11 -2
View File
@@ -2651,6 +2651,9 @@ class APIEndpoints:
<script src="https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui-standalone-preset.js"></script>
<script>
window.onload = function() {
// Use current browser location for API calls
const currentUrl = window.location.protocol + '//' + window.location.host + '/api';
const ui = SwaggerUIBundle({
url: '/api/openapi',
dom_id: '#swagger-ui',
@@ -2679,10 +2682,16 @@ class APIEndpoints:
showExtensions: true,
showCommonExtensions: true,
tagsSorter: "alpha",
operationsSorter: "alpha"
operationsSorter: "alpha",
// Override servers list to use current host
servers: [
{
url: currentUrl,
description: "Current host"
}
]
});
// Add API info to title
window.ui = ui;
};
</script>
+127
View File
@@ -645,6 +645,133 @@ paths:
items:
$ref: '#/components/schemas/Identity'
/acl_info:
get:
tags: [ACL]
summary: Get ACL information
description: Get access control list information for identities
parameters:
- name: identity_hash
in: query
schema:
type: string
pattern: '^0x[0-9a-fA-F]{2}$'
description: Identity hash
example: "0x42"
- name: identity_name
in: query
schema:
type: string
description: Identity name
example: "General"
responses:
'200':
description: ACL information
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
data:
type: object
/acl_clients:
get:
tags: [ACL]
summary: List ACL clients
description: Get list of clients in access control list
parameters:
- name: identity_hash
in: query
schema:
type: string
pattern: '^0x[0-9a-fA-F]{2}$'
description: Identity hash
example: "0x42"
- name: identity_name
in: query
schema:
type: string
description: Identity name
example: "General"
responses:
'200':
description: ACL clients list
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
clients:
type: array
items:
$ref: '#/components/schemas/ACLEntry'
/acl_remove_client:
post:
tags: [ACL]
summary: Remove client from ACL
description: Remove a client from the access control list
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [identity_hash, client_pubkey]
properties:
identity_hash:
type: string
pattern: '^0x[0-9a-fA-F]{2}$'
description: Identity hash
example: "0x42"
identity_name:
type: string
description: Identity name (alternative to hash)
example: "General"
client_pubkey:
type: string
pattern: '^[0-9a-fA-F]{64}$'
description: Client public key to remove
example: "abc123def456..."
responses:
'200':
description: Client removed from ACL
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
/acl_stats:
get:
tags: [ACL]
summary: Get ACL statistics
description: Get statistics about access control lists
responses:
'200':
description: ACL statistics
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
total_entries:
type: integer
by_identity:
type: object
/room_messages:
get:
tags: [Room Server]