API: Improve audit log messages in the cluster endpoint handlers

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-10-20 14:29:40 +02:00
parent ced4be2e40
commit 252aff2a6b
6 changed files with 125 additions and 49 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/photoprism/photoprism/internal/auth/acl"
"github.com/photoprism/photoprism/internal/event"
"github.com/photoprism/photoprism/internal/photoprism/get"
"github.com/photoprism/photoprism/internal/service/cluster"
reg "github.com/photoprism/photoprism/internal/service/cluster/registry"
@@ -51,14 +52,24 @@ func ClusterSummary(router *gin.RouterGroup) {
themeVersion = v
}
c.JSON(http.StatusOK, cluster.SummaryResponse{
resp := cluster.SummaryResponse{
UUID: conf.ClusterUUID(),
ClusterCIDR: conf.ClusterCIDR(),
Nodes: len(nodes),
Database: cluster.DatabaseInfo{Driver: conf.DatabaseDriverName(), Host: conf.DatabaseHost(), Port: conf.DatabasePort()},
Theme: themeVersion,
Time: time.Now().UTC().Format(time.RFC3339),
})
}
event.AuditDebug([]string{
ClientIP(c),
"session %s",
string(acl.ResourceCluster),
"get summary for cluster uuid %s",
event.Succeeded,
}, s.RefID, conf.ClusterUUID())
c.JSON(http.StatusOK, resp)
})
}
@@ -85,6 +96,13 @@ func ClusterHealth(router *gin.RouterGroup) {
return
}
event.AuditDebug([]string{
ClientIP(c),
string(acl.ResourceCluster),
"health check",
event.Succeeded,
})
c.JSON(http.StatusOK, NewHealthResponse("ok"))
})
}