Changeset 0.28.0.4 (#176)

This commit is contained in:
2026-03-12 12:12:17 +00:00
parent f5171d3bd3
commit 52bd36ba48
16 changed files with 520 additions and 292 deletions

View File

@@ -107,7 +107,7 @@ func (h *GroupHandler) CreateGroup(c *gin.Context) {
}
c.JSON(http.StatusCreated, g)
AuditLog(c, "group.create", "group", g.ID, map[string]interface{}{
AuditLog(h.stores.Audit, c, "group.create", "group", g.ID, map[string]interface{}{
"name": g.Name, "scope": g.Scope,
})
}
@@ -183,7 +183,7 @@ func (h *GroupHandler) UpdateGroup(c *gin.Context) {
}
c.JSON(http.StatusOK, gin.H{"ok": true})
AuditLog(c, "group.update", "group", id, nil)
AuditLog(h.stores.Audit, c, "group.update", "group", id, nil)
}
// ── Admin: Delete Group ─────────────────────
@@ -206,7 +206,7 @@ func (h *GroupHandler) DeleteGroup(c *gin.Context) {
}
c.JSON(http.StatusOK, gin.H{"ok": true})
AuditLog(c, "group.delete", "group", id, nil)
AuditLog(h.stores.Audit, c, "group.delete", "group", id, nil)
}
// ── Members: List ───────────────────────────
@@ -259,7 +259,7 @@ func (h *GroupHandler) AddMember(c *gin.Context) {
}
c.JSON(http.StatusOK, gin.H{"ok": true})
AuditLog(c, "group.member.add", "group", groupID, map[string]interface{}{
AuditLog(h.stores.Audit, c, "group.member.add", "group", groupID, map[string]interface{}{
"user_id": req.UserID,
})
}
@@ -289,7 +289,7 @@ func (h *GroupHandler) RemoveMember(c *gin.Context) {
}
c.JSON(http.StatusOK, gin.H{"ok": true})
AuditLog(c, "group.member.remove", "group", groupID, map[string]interface{}{
AuditLog(h.stores.Audit, c, "group.member.remove", "group", groupID, map[string]interface{}{
"user_id": userID,
})
}
@@ -375,7 +375,7 @@ func (h *GroupHandler) SetResourceGrant(c *gin.Context) {
if req.GrantScope == models.GrantScopeTeamOnly {
_ = h.stores.ResourceGrants.Delete(c.Request.Context(), resourceType, resourceID)
c.JSON(http.StatusOK, gin.H{"ok": true})
AuditLog(c, "grant.revoke", resourceType, resourceID, nil)
AuditLog(h.stores.Audit, c, "grant.revoke", resourceType, resourceID, nil)
return
}
@@ -393,7 +393,7 @@ func (h *GroupHandler) SetResourceGrant(c *gin.Context) {
}
c.JSON(http.StatusOK, grant)
AuditLog(c, "grant.set", resourceType, resourceID, map[string]interface{}{
AuditLog(h.stores.Audit, c, "grant.set", resourceType, resourceID, map[string]interface{}{
"grant_scope": req.GrantScope,
})
}
@@ -415,7 +415,7 @@ func (h *GroupHandler) DeleteResourceGrant(c *gin.Context) {
}
c.JSON(http.StatusOK, gin.H{"ok": true})
AuditLog(c, "grant.delete", resourceType, resourceID, nil)
AuditLog(h.stores.Audit, c, "grant.delete", resourceType, resourceID, nil)
}
// ListPermissions returns all valid permission strings.