add getUserObjFromUsername util function,

update all backends to use userObj,
add user backend manager wrapper which calls all linked backends dealing with user data,
list backend handlers for each realm
This commit is contained in:
2024-06-03 18:09:28 +00:00
parent bb7404a82d
commit b12f38e608
13 changed files with 211 additions and 109 deletions

View File

@@ -53,14 +53,19 @@ export default class LocalDB extends DB_BACKEND {
}
setUser (user, attributes, params = null) {
const username = `${user.id}@${user.realm}`;
if (this.#data.users[username]) {
this.#data.users[username] = attributes;
this.#save();
return true;
if (attributes.resources && attributes.cluster && attributes.templates) { // localdb should only deal with these attributes
const username = `${user.id}@${user.realm}`;
if (this.#data.users[username]) {
this.#data.users[username] = attributes;
this.#save();
return true;
}
else {
return false;
}
}
else {
return false;
else { // if request is not setting these attributes, then assume its fine but do nothing
return true;
}
}