diff --git a/src/backends/backends.js b/src/backends/backends.js index d830394..5fc5932 100644 --- a/src/backends/backends.js +++ b/src/backends/backends.js @@ -77,5 +77,16 @@ export class DB_BACKEND extends BACKEND { * Interface for user auth backends. */ export class AUTH_BACKEND extends BACKEND { - modUser (username, attributes, params = null) {} + addUser (username, attributes, params = null) {} + getUser (username, params=null) {} + setUser (username, attributes, params = null) {} + deluser (username, params = null) {} + + addGroup (groupname, attributes, params = null) {} + getGroup (groupname, params=null) {} + setGroup (groupname, attributes, params = null) {} + delGroup (groupname, params = null) {} + + addUserToGrou (username, groupname, params = null) {} + delUserFromGroup (username, groupname, params = null) {} } diff --git a/src/backends/paasldap.js b/src/backends/paasldap.js index 3dbf7d9..9a9a1d2 100644 --- a/src/backends/paasldap.js +++ b/src/backends/paasldap.js @@ -69,7 +69,7 @@ export default class PAASLDAP extends AUTH_BACKEND { } } - async modUser (userid, attributes, ticket) { + async setUser (userid, attributes, ticket) { return await this.#request(`/users/${userid}`, "POST", ticket, attributes); } } diff --git a/src/routes/auth.js b/src/routes/auth.js index 6bdf0bb..bb22d91 100644 --- a/src/routes/auth.js +++ b/src/routes/auth.js @@ -123,7 +123,7 @@ router.post("/password", async (req, res) => { const newAttributes = { userpassword: params.password }; - const response = await handler.modUser(userID, newAttributes, req.cookies); + const response = await handler.setUser(userID, newAttributes, req.cookies); if (response.ok) { res.status(response.status).send(); } diff --git a/template.localdb.json b/template.localdb.json new file mode 100644 index 0000000..5bf5422 --- /dev/null +++ b/template.localdb.json @@ -0,0 +1,128 @@ +{ + "users": { + "exampleuser@auth": { + "resources": { + "cpu": { + "global": [ + { + "match": "kvm64", + "name": "kvm64", + "max": 1 + }, + { + "match": "host", + "name": "host", + "max": 1 + } + ], + "nodes": {} + }, + "cores": { + "global": { + "max": 128 + }, + "nodes": {} + }, + "memory": { + "global": { + "max": 131072 + }, + "nodes": {} + }, + "swap": { + "global": { + "max": 131072 + }, + "nodes": {} + }, + "local": { + "global": { + "max": 1099511627776 + }, + "nodes": {} + }, + "cephpl": { + "global": { + "max": 1099511627776 + }, + "nodes": {} + }, + "network": { + "global": { + "max": 100000 + }, + "nodes": {} + }, + "pci": { + "global": [], + "nodes": { + "example-node-0": [ + { + "match": "[device 1]", + "name": "Device 1", + "max": 1 + }, + { + "match": "[device 2]", + "name": "Device 2", + "max": 1 + } + ] + } + } + }, + "nodes": [ + "example-node-0", + "example-node-1", + "example-node-2" + ], + "cluster": { + "vmid": { + "min": 100, + "max": 199 + }, + "pool": "examplepool" + }, + "templates": { + "instances": { + "lxc": { + "net0": { + "value": "name=eth0,bridge=vmbr0,ip=dhcp,ip6=dhcp,tag=10,type=veth,rate=1000", + "resource": { + "name": "network", + "amount": 1000 + } + } + }, + "qemu": { + "cpu": { + "value": "host", + "resource": null + }, + "net0": { + "value": "virtio,bridge=vmbr0,tag=10,rate=1000", + "resource": { + "name": "network", + "amount": 1000 + } + } + } + }, + "network": { + "lxc": { + "type": "veth", + "bridge": "vmbr0", + "vlan": 10, + "ip": "dhcp", + "ip6": "dhcp" + }, + "qemu": { + "type": "virtio", + "bridge": "vmbr0", + "vlan": 10 + } + } + } + } + } +} \ No newline at end of file