added admin page and audit log viewing
This commit is contained in:
@@ -171,17 +171,65 @@ func addRoutes(
|
||||
|
||||
// Admin routes
|
||||
adminRoutes := []hws.Route{
|
||||
// Full page routes (for direct navigation and refreshes)
|
||||
{
|
||||
// TODO: on page load, redirect to /admin/users
|
||||
Path: "/admin",
|
||||
Method: hws.MethodGET,
|
||||
Handler: perms.RequireAdmin(s)(handlers.AdminDashboard(s, conn)),
|
||||
},
|
||||
{
|
||||
Path: "/admin/users",
|
||||
Method: hws.MethodGET,
|
||||
Handler: perms.RequireAdmin(s)(handlers.AdminUsersPage(s, conn)),
|
||||
},
|
||||
{
|
||||
Path: "/admin/roles",
|
||||
Method: hws.MethodGET,
|
||||
Handler: perms.RequireAdmin(s)(handlers.AdminRolesPage(s, conn)),
|
||||
},
|
||||
{
|
||||
Path: "/admin/permissions",
|
||||
Method: hws.MethodGET,
|
||||
Handler: perms.RequireAdmin(s)(handlers.AdminPermissionsPage(s, conn)),
|
||||
},
|
||||
{
|
||||
Path: "/admin/audit",
|
||||
Method: hws.MethodGET,
|
||||
Handler: perms.RequireAdmin(s)(handlers.AdminAuditLogsPage(s, conn)),
|
||||
},
|
||||
// HTMX content fragment routes (for section swapping)
|
||||
{
|
||||
Path: "/admin/users",
|
||||
Method: hws.MethodPOST,
|
||||
Handler: perms.RequireAdmin(s)(handlers.AdminUsersList(s, conn)),
|
||||
},
|
||||
{
|
||||
Path: "/admin/roles",
|
||||
Method: hws.MethodPOST,
|
||||
Handler: perms.RequireAdmin(s)(handlers.AdminRolesList(s, conn)),
|
||||
},
|
||||
{
|
||||
Path: "/admin/permissions",
|
||||
Method: hws.MethodPOST,
|
||||
Handler: perms.RequireAdmin(s)(handlers.AdminPermissionsList(s, conn)),
|
||||
},
|
||||
{
|
||||
Path: "/admin/audit",
|
||||
Method: hws.MethodPOST,
|
||||
Handler: perms.RequireAdmin(s)(handlers.AdminAuditLogsList(s, conn)),
|
||||
},
|
||||
// Audit log filtering (returns only results table, no URL push)
|
||||
{
|
||||
Path: "/admin/audit/filter",
|
||||
Method: hws.MethodPOST,
|
||||
Handler: perms.RequireAdmin(s)(handlers.AdminAuditLogsFilter(s, conn)),
|
||||
},
|
||||
// Audit log detail modal
|
||||
{
|
||||
Path: "/admin/audit/{id}",
|
||||
Method: hws.MethodGET,
|
||||
Handler: perms.RequireAdmin(s)(handlers.AdminAuditLogDetail(s, conn)),
|
||||
},
|
||||
}
|
||||
|
||||
routes := append(pageroutes, htmxRoutes...)
|
||||
|
||||
Reference in New Issue
Block a user