assign pool membership of new isntance using user group membership
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
2e6840ce99
commit
eb5b39ea22
8
main.js
8
main.js
@ -186,11 +186,17 @@ app.post("/api/instance", async (req, res) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let user = await requestPVE(`/access/users/${req.cookies.username}`, "GET", null, null, pveAPIToken);
|
||||||
|
let group = user.data.data.groups[0];
|
||||||
|
if (!group) {
|
||||||
|
res.send({auth: auth, data: {error: `user ${req.cookies.username} has no group membership`}});
|
||||||
|
}
|
||||||
|
|
||||||
let action = {
|
let action = {
|
||||||
vmid: req.body.vmid,
|
vmid: req.body.vmid,
|
||||||
cores: req.body.cores,
|
cores: req.body.cores,
|
||||||
memory: req.body.memory,
|
memory: req.body.memory,
|
||||||
pool: req.cookies.username.replace("@ldap", "")
|
pool: group
|
||||||
};
|
};
|
||||||
if (req.body.type === "lxc") {
|
if (req.body.type === "lxc") {
|
||||||
action.swap = req.body.swap;
|
action.swap = req.body.swap;
|
||||||
|
Loading…
Reference in New Issue
Block a user