add localdb template,

update paasldap backend interface
This commit is contained in:
Arthur Lu 2024-01-30 20:33:41 +00:00
parent c347a3b8c0
commit fae79e4ab0
4 changed files with 142 additions and 3 deletions

View File

@ -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) {}
}

View File

@ -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);
}
}

View File

@ -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();
}

128
template.localdb.json Normal file
View File

@ -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
}
}
}
}
}
}