implement full interface for paasldap backend
This commit is contained in:
parent
0b5cfff519
commit
848eb5d1d1
@ -69,7 +69,43 @@ export default class PAASLDAP extends AUTH_BACKEND {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async setUser (userid, attributes, ticket) {
|
async addUser (user, attributes, params = null) {
|
||||||
return await this.#request(`/users/${userid}`, "POST", ticket, attributes);
|
return await this.#request(`/users/${user.id}`, "POST", params, attributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getUser (user, params = null) {
|
||||||
|
return await this.#request(`/users/${user.id}`, "GET", params);
|
||||||
|
}
|
||||||
|
|
||||||
|
async setUser (user, attributes, params = null) {
|
||||||
|
return await this.#request(`/users/${user.id}`, "POST", params, attributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
async delUser (user, params = null) {
|
||||||
|
return await this.#request(`/users/${user.id}`, "DELETE", params);
|
||||||
|
}
|
||||||
|
|
||||||
|
async addGroup (group, attributes, params = null) {
|
||||||
|
return await this.#request(`/groups/${group.id}`, "POST", params);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getGroup (group, params = null) {
|
||||||
|
return await this.#request(`/groups/${group.id}`, "GET", params);
|
||||||
|
}
|
||||||
|
|
||||||
|
async setGroup (group, attributes, params = null) {
|
||||||
|
// not implemented, LDAP groups do not have any attributes to change
|
||||||
|
}
|
||||||
|
|
||||||
|
async delGroup (group, params = null) {
|
||||||
|
return await this.#request(`/groups/${group.id}`, "DELETE", params);
|
||||||
|
}
|
||||||
|
|
||||||
|
async addUserToGroup (user, group, params = null) {
|
||||||
|
return await this.#request(`/groups/${group.id}/members/${user.id}`, "POST", params);
|
||||||
|
}
|
||||||
|
|
||||||
|
async delUserFromGroup (user, group, params = null) {
|
||||||
|
return await this.#request(`/groups/${group.id}/members/${user.id}`, "DELETE", params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class CookieFetcher {
|
|||||||
this.#cookies = this.#cookies.concat(response.cookies);
|
this.#cookies = this.#cookies.concat(response.cookies);
|
||||||
this.#fetchedBackends.push(backend);
|
this.#fetchedBackends.push(backend);
|
||||||
}
|
}
|
||||||
else { // assume that a repeat backends should not be requested
|
else { // assume that repeat backends should not be requested
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,14 +116,14 @@ router.post("/password", async (req, res) => {
|
|||||||
|
|
||||||
const userRealm = params.username.split("@").at(-1);
|
const userRealm = params.username.split("@").at(-1);
|
||||||
const authHandlers = global.config.handlers.auth;
|
const authHandlers = global.config.handlers.auth;
|
||||||
|
const userID = params.username.replace(`@${userRealm}`, "");
|
||||||
|
const userObj = { id: userID, realm: userRealm };
|
||||||
if (userRealm in authHandlers) {
|
if (userRealm in authHandlers) {
|
||||||
const handler = authHandlers[userRealm];
|
const handler = authHandlers[userRealm];
|
||||||
const userID = params.username.replace(`@${userRealm}`, "");
|
|
||||||
const newAttributes = {
|
const newAttributes = {
|
||||||
userpassword: params.password
|
userpassword: params.password
|
||||||
};
|
};
|
||||||
const response = await handler.setUser(userID, newAttributes, req.cookies);
|
const response = await handler.setUser(userObj, newAttributes, req.cookies);
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
res.status(response.status).send(response.data);
|
res.status(response.status).send(response.data);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user