From 0873cc0b67a5e3103f1efea8f3b6a18b116b0751 Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Sun, 31 Mar 2019 13:50:50 +0000 Subject: [server/registration] Performance improvements & add automatic registration with custom name Manual registration now sends the client as json idoit: Add server bug fixes shell: Fix building pcbios ipxe version eslint fixes --- server/api/registration.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'server/api/registration.js') diff --git a/server/api/registration.js b/server/api/registration.js index 20e8618..0a9a4cb 100644 --- a/server/api/registration.js +++ b/server/api/registration.js @@ -136,7 +136,6 @@ noAuthRouter.postAsync('/clients', async (req, res) => { client.id = newClient.id // Add groups to the client. - // if (client.parents.length === 0) client.parents = await ipHelper.getGroups(client.network.ip) if (client.parents.length === 0) client.parents = await ipHelper.getGroups(client.networks[0].ip) client.parents.forEach(pid => { newClient.addGroup(pid) }) log({ category: 'CLIENT_REGISTRATION', description: 'Client added successfully.', clientId: newClient.id }) @@ -338,9 +337,9 @@ function buildIpxeMenu (id, name, groups, parents) { // Add client menu script += 'item select Add client to ' + toAscii(name) + '\r\n' - menuscript += `:select\r\necho Enter client name\r\nread clientname\r\nparams\r\nparam name \${clientname}\r\n` - menuscript += 'param id ' + id + `\r\nparam mac \${net0/mac}\r\nparam uuid \${uuid}\r\nparam ip \${net0/ip}\r\n` - menuscript += 'chain --replace ' + basUrl + '/api/registration/add##params\r\n\r\n' + menuscript += `:select\r\necho Enter client name\r\nread clientname\r\nparams\r\n` + menuscript += `param client { "name": "\${clientname}", "type": "CLIENT", "uuid": "\${uuid}", "purpose": "Pool PC", "networks": [{ "ip": "\${net0/ip}", "mac": "\${net0/mac}" }] }\r\n` + menuscript += 'chain --replace ' + basUrl + '/api/registration/clients##params\r\n\r\n' // Goto start menu if (id !== '0') { -- cgit v1.2.3-55-g7522