add role based permissions

This commit is contained in:
Aditya Siregar
2025-08-19 21:29:37 +07:00
parent 7d5f061a1b
commit 6da48504fa
12 changed files with 461 additions and 12 deletions
+5
View File
@@ -31,6 +31,11 @@ type RBACHandler interface {
UpdateRole(c *gin.Context)
DeleteRole(c *gin.Context)
ListRoles(c *gin.Context)
// New methods
GetPermissionsGrouped(c *gin.Context)
CreateOrUpdateRole(c *gin.Context)
GetRoleDetail(c *gin.Context)
}
type MasterHandler interface {
+8
View File
@@ -113,6 +113,14 @@ func (r *Router) addAppRoutes(rg *gin.Engine) {
rbac.DELETE("/roles/:id", r.rbacHandler.DeleteRole)
}
roles := v1.Group("/roles")
roles.Use(r.authMiddleware.RequireAuth())
{
roles.POST("", r.rbacHandler.CreateOrUpdateRole)
roles.GET("/permissions", r.rbacHandler.GetPermissionsGrouped)
roles.GET("/:id", r.rbacHandler.GetRoleDetail)
}
master := v1.Group("/master")
master.Use(r.authMiddleware.RequireAuth())
{