1
0
Fork 0
mirror of synced 2024-06-27 18:40:42 +12:00
budibase/packages/server/src/api/routes/user.js

19 lines
593 B
JavaScript
Raw Normal View History

2020-05-07 21:53:34 +12:00
const Router = require("@koa/router")
const controller = require("../controllers/user")
2020-05-22 01:31:23 +12:00
const authorized = require("../../middleware/authorized")
const { USER_MANAGEMENT, LIST_USERS } = require("../../utilities/accessLevels")
2020-05-07 21:53:34 +12:00
const router = Router()
2020-05-05 04:13:57 +12:00
router
2020-06-19 03:59:31 +12:00
.get("/api/users", authorized(LIST_USERS), controller.fetch)
.get("/api/users/:username", authorized(USER_MANAGEMENT), controller.find)
.post("/api/users", authorized(USER_MANAGEMENT), controller.create)
2020-05-22 01:31:23 +12:00
.delete(
2020-06-19 03:59:31 +12:00
"/api/users/:username",
2020-05-22 01:31:23 +12:00
authorized(USER_MANAGEMENT),
controller.destroy
)
2020-05-07 21:53:34 +12:00
module.exports = router