Skip to content

Commit

Permalink
Added RBAC Full
Browse files Browse the repository at this point in the history
  • Loading branch information
AriaFantom committed Oct 4, 2024
1 parent 8857c7c commit b70a313
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions backend/routes/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@ func HandleRoutes(app *fiber.App) {

// RBAC routes
app.Get("/permissions", handler.FetchAllPermissions, middleware.CheckPermission("read:role"))
app.Put("/roleuser", handler.UpdateRoleToUser, middleware.CheckPermission("update:role"))

app.Post("/roles", handler.InsertRoles)
app.Get("/roles", handler.FetchRoles)
app.Put("/roles", handler.UpdateRoles)
app.Post("/roles", handler.InsertRoles, middleware.CheckPermission("create:role"))
app.Get("/roles", handler.FetchRoles, middleware.CheckPermission("read:role"))
app.Put("/roles", handler.UpdateRoles, middleware.CheckPermission("update:role"))

// Inventory addition routes
app.Post("/categories", handler.CreateCategory, middleware.IsAuthorized)
app.Post("/suppliers", handler.CreateSupplier, middleware.IsAuthorized)
app.Post("/inventory", handler.CreateInventory, middleware.IsAuthorized)
app.Post("/categories", handler.CreateCategory, middleware.CheckPermission("create:category"))
app.Post("/suppliers", handler.CreateSupplier, middleware.CheckPermission("create:supplier"))
app.Post("/inventory", handler.CreateInventory, middleware.CheckPermission("create:inventory"))

// Inventory fetch routes
app.Get("/categories", handler.FetchAllCategories)
app.Get("/suppliers", handler.FetchAllSuppliers)
app.Get("/inventory", handler.FetchAllInventory)
app.Get("/categories", handler.FetchAllCategories, middleware.CheckPermission("read:category"))
app.Get("/suppliers", handler.FetchAllSuppliers, middleware.CheckPermission("read:supplier"))
app.Get("/inventory", handler.FetchAllInventory, middleware.CheckPermission("read:inventory"))

}

0 comments on commit b70a313

Please sign in to comment.