From 36c11fabc18758609167c14634b0c37524650bdc Mon Sep 17 00:00:00 2001 From: gowthaman Date: Mon, 27 May 2024 21:46:11 +0530 Subject: [PATCH] some more permission related things --- src/main/kotlin/com/restapi/Main.kt | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main/kotlin/com/restapi/Main.kt b/src/main/kotlin/com/restapi/Main.kt index bc971f3..73ce1d5 100644 --- a/src/main/kotlin/com/restapi/Main.kt +++ b/src/main/kotlin/com/restapi/Main.kt @@ -110,7 +110,7 @@ fun main(args: Array) { post("/batch", VendorCtrl::createBatch, Roles(Role.Explicit("ROLE_VENDOR_CREATE"))) get("/{id}", VendorCtrl::get, Roles(Role.Explicit("ROLE_VENDOR_VIEW", "ROLE_VENDOR_CREATE"))) post( - "/getAll", VendorCtrl::getAll, Roles(Role.Explicit("ROLE_VENDOR_VIEW", "ROLE_VENDOR_CREATE")) + "/getAll", VendorCtrl::getAll ) get( "quotes/{id}", VendorCtrl::getQuotes, Roles(Role.Explicit("ROLE_QUOTE_VIEW", "ROLE_QUOTE_CREATE", "ROLE_VENDOR_VIEW")) @@ -121,13 +121,7 @@ fun main(args: Array) { } path("/incoming") { get( - "/plants", IncomingInventoryCtrl::plantsForUser, - Roles( - Role.Explicit("ROLE_INVENTORY_CREATE"), - Role.Explicit("ROLE_VENDOR_VIEW"), - Role.Explicit("ROLE_VENDOR_CREATE"), - Role.Explicit("ROLE_INVENTORY_VIEW") - ) + "/plants", IncomingInventoryCtrl::plantsForUser ) put( "/plants/{id}", IncomingInventoryCtrl::updatePlant, @@ -187,12 +181,14 @@ fun main(args: Array) { ) put("/{id}", FleetCtrl::update, Roles(Role.Explicit("ROLE_FLEET_CREATE"))) post( - "/getAll", FleetCtrl::getAll, Roles(Role.Explicit( - "ROLE_FLEET_CREATE", - "ROLE_FLEET_VIEW", - "ROLE_EXPENSE_CREATE", - "ROLE_EXPENSE_VIEW", - )) + "/getAll", FleetCtrl::getAll, Roles( + Role.Explicit( + "ROLE_FLEET_CREATE", + "ROLE_FLEET_VIEW", + "ROLE_EXPENSE_CREATE", + "ROLE_EXPENSE_VIEW", + ) + ) ) delete("/{id}", FleetCtrl::delete, Roles(Role.Explicit("ROLE_FLEET_CREATE"))) }