fix users list on app overview
This commit is contained in:
parent
d80b832371
commit
13c2551e9a
|
@ -6,6 +6,7 @@ const Joi = require("joi")
|
||||||
const cloudRestricted = require("../../../middleware/cloudRestricted")
|
const cloudRestricted = require("../../../middleware/cloudRestricted")
|
||||||
const { buildUserSaveValidation } = require("../../utilities/validation")
|
const { buildUserSaveValidation } = require("../../utilities/validation")
|
||||||
const selfController = require("../../controllers/global/self")
|
const selfController = require("../../controllers/global/self")
|
||||||
|
const builderOrAdmin = require("../../../middleware/builderOrAdmin")
|
||||||
|
|
||||||
const router = Router()
|
const router = Router()
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ router
|
||||||
buildUserSaveValidation(),
|
buildUserSaveValidation(),
|
||||||
controller.save
|
controller.save
|
||||||
)
|
)
|
||||||
.get("/api/global/users", adminOnly, controller.fetch)
|
.get("/api/global/users", builderOrAdmin, controller.fetch)
|
||||||
.delete("/api/global/users/:id", adminOnly, controller.destroy)
|
.delete("/api/global/users/:id", adminOnly, controller.destroy)
|
||||||
.get("/api/global/roles/:appId")
|
.get("/api/global/roles/:appId")
|
||||||
.post(
|
.post(
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
module.exports = async (ctx, next) => {
|
||||||
|
if (
|
||||||
|
!ctx.internal &&
|
||||||
|
(!ctx.user || !ctx.user.builder || !ctx.user.builder.global) &&
|
||||||
|
(!ctx.user || !ctx.user.admin || !ctx.user.admin.global)
|
||||||
|
) {
|
||||||
|
ctx.throw(403, "Builder user only endpoint.")
|
||||||
|
}
|
||||||
|
return next()
|
||||||
|
}
|
Loading…
Reference in New Issue