mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-27 07:02:15 +00:00
feat: Add subscriber management API endpoints with RBAC authorization
- Add SubscriberHandler to serverDeps with NewSubscriberService initialization - Add subscriber routes to v1 API with GET (list, by id, by IMSI) and protected POST/PUT operations - Add RBAC enforcement for subscriber creation, updates, suspension, and termination (admin, operator roles) - Add registerSubscriberRoutes function with /subscribers endpoint group
This commit is contained in:
@@ -57,6 +57,7 @@ func registerV1Routes(router *gin.Engine, d *serverDeps) {
|
||||
apiProtected := v1.Group("/")
|
||||
apiProtected.Use(middleware.AuthMiddleware(d.authSvc))
|
||||
{
|
||||
registerSubscriberRoutes(apiProtected, d)
|
||||
registerServicesRoutes(apiProtected, d)
|
||||
registerMonitoringRoutes(apiProtected, d)
|
||||
registerDeployRoutes(apiProtected, d)
|
||||
@@ -173,3 +174,17 @@ func registerChaosRoutes(api *gin.RouterGroup, d *serverDeps) {
|
||||
applyRBAC(w, d.casbinSvc, "/v1/chaos", "POST", "admin")
|
||||
w.POST("/experiments", d.chaosH.Run)
|
||||
}
|
||||
|
||||
func registerSubscriberRoutes(api *gin.RouterGroup, d *serverDeps) {
|
||||
subs := api.Group("/subscribers")
|
||||
subs.GET("", d.subscriberH.ListSubscribers)
|
||||
subs.GET("/:id", d.subscriberH.GetSubscriber)
|
||||
subs.GET("/imsi/:imsi", d.subscriberH.GetSubscriberByIMSI)
|
||||
|
||||
w := subs.Group("/")
|
||||
applyRBAC(w, d.casbinSvc, "/v1/subscribers", "POST", "admin", "operator")
|
||||
w.POST("", d.subscriberH.CreateSubscriber)
|
||||
w.PUT("/:id", d.subscriberH.UpdateSubscriber)
|
||||
w.POST("/:id/suspend", d.subscriberH.SuspendSubscriber)
|
||||
w.POST("/:id/terminate", d.subscriberH.TerminateSubscriber)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user