initial updates to api v2.0.0:
- switch access backend to access-manager-api - change resource quota to pool based - simplify backend system - various cleanup
This commit is contained in:
@@ -3,22 +3,6 @@ export const router = Router({ mergeParams: true });
|
||||
|
||||
const checkAuth = global.utils.checkAuth;
|
||||
|
||||
/**
|
||||
* GET - get all groups
|
||||
* responses:
|
||||
* - 200: {auth: true, groups: Array}
|
||||
* - 401: {auth: false}
|
||||
*/
|
||||
router.get("/", async (req, res) => {
|
||||
// check auth
|
||||
const auth = await checkAuth(req.cookies, res);
|
||||
if (!auth) {
|
||||
return;
|
||||
}
|
||||
const groups = await global.userManager.getAllGroups(req.cookies);
|
||||
res.status(200).send({ groups });
|
||||
});
|
||||
|
||||
/**
|
||||
* GET - get specific group
|
||||
* request:
|
||||
@@ -36,6 +20,14 @@ router.get("/:groupname", async (req, res) => {
|
||||
if (!auth) {
|
||||
return;
|
||||
}
|
||||
const group = await global.userManager.getGroup(params.groupname, req.cookies);
|
||||
|
||||
const groupObj = global.utils.getGroupObjFromGroupname(params.groupname);
|
||||
const g = await global.access.getGroup(groupObj, req.cookies);
|
||||
if (g.ok !== true) {
|
||||
res.status(g.status).send(g);
|
||||
return;
|
||||
}
|
||||
const group = g.group;
|
||||
|
||||
res.status(200).send({ group });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user