diff --git a/README.md b/README.md index 27c4f1d..35b7f5e 100644 --- a/README.md +++ b/README.md @@ -67,4 +67,38 @@ server { ### Result After these steps, the ProxmoxAAS Dashboard should be available and fully functional at `paas.` or `paas./dashboard/`. -# Backends \ No newline at end of file +# Backends + +Backend handlers are used to interface with any number and type of backend data source used to store ProxmoxAAS data. Most data involves users, groups, and membership relationships. The default backends are sufficient to run a small cluster, but additional backend handlers can be created. + +## Interface + +Each backend must implement the following methods: + +||| +|-|-| +|openSession|opens a session to the backend by creating a session token| +|closeSession|closes a session to the backend| + +Additionally, backends dealing with user data may also need to implement: + +||| +|-|-| +|addUser|create a user| +|getUser|retrieve user data including membership| +|setUser|modify a user| +|delUser|delete a user| +|addGroup|create a group| +|getGroup|retrieve group data including members| +|setGroup|modify group data except membership| +|delGroup|delete group| +|addUserToGroup|add user to group as member| +|deluserFromGroup|remove user from group| + +Not all user backends will necessarily implement all the methods fully. For example, backends which do not store group data may not need to implement the group related methods. + +Specific documentation can be found in `src/backends/backends.js`. + +## Multiple Interfaces + +Multiple backends can be specified using the config. During a backend operation involving users, each backend method will be called in the order specified in the config. If the operation is to retrieve user data, the responses will be merged favoring the last backend called. \ No newline at end of file diff --git a/src/backends/backends.js b/src/backends/backends.js index 8b80a73..51b8ad3 100644 --- a/src/backends/backends.js +++ b/src/backends/backends.js @@ -28,7 +28,7 @@ export default async () => { class BACKEND { /** * Opens a session with the backend and creates session tokens if needed - * @param {{id: string, realm: string}} user object containing username and password fields + * @param {{id: string, realm: string}} user object containing id and realm * @param {string} password * @returns {{ok: boolean, status: number, message: string, cookies: {name: string, value: string}[]}} response like object with list of session token objects with token name and value */