feat(api): organize monitors in groups with inherited permissions

Assignments scoped to a group cover all monitors and subgroups below it,
so people can be given exactly one branch of the tree. Deleting a group
moves its content one level up and drops assignments scoped to it.

Refs #57

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 09:19:55 +01:00
1 parent 2d7f326d38
commit 11482ec6d5
4 files changed
+497 -21

No files matched your search

+11 -5
View File
@@ -107,12 +107,18 @@ func (s *Server) Mount(r gin.IRouter) {
org := v1.Group("/org", s.orgAccess())
org.PUT("/policy", sessionOnly(), can(authz.OrgManage), s.updatePolicy)
org.GET("/monitors", can(authz.MonitorsRead), s.listMonitors)
org.POST("/monitors", can(authz.MonitorsWrite), s.createMonitor)
org.PUT("/monitors/:id", can(authz.MonitorsWrite), s.updateMonitor)
org.DELETE("/monitors/:id", can(authz.MonitorsWrite), s.deleteMonitor)
// Monitor and group handlers check permissions themselves: assignments
// scoped to a group grant access below that group only.
org.GET("/monitors", s.listMonitors)
org.POST("/monitors", s.createMonitor)
org.PUT("/monitors/:id", s.updateMonitor)
org.DELETE("/monitors/:id", s.deleteMonitor)
org.GET("/groups", s.listGroups)
org.POST("/groups", s.createGroup)
org.PUT("/groups/:id", s.updateGroup)
org.DELETE("/groups/:id", s.deleteGroup)
org.GET("/regions", can(authz.MonitorsRead), s.listOrgRegions)
org.GET("/regions", s.listOrgRegions)
org.POST("/regions", sessionOnly(), can(authz.OrgManage), s.createOrgRegion)
org.DELETE("/regions/:id", sessionOnly(), can(authz.OrgManage), s.deleteOrgRegion)
org.GET("/agents", can(authz.OrgManage), s.listOrgAgents)