[PR #1119] DRAFT: Initial plugin support #1133

Open
opened 2026-02-27 09:11:02 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/lldap/lldap/pull/1119
Author: @broeng
Created: 2/28/2025
Status: 🔄 Open

Base: mainHead: plugin-support


📝 Commits (10+)

  • 2b5852e handlers: provide RequestContext with userinfo to handlers
  • 72909ba crate: adds a KeyValueStore trait with a new crate
  • 4d3614a crate: add PluginKeyValueStore with DB model
  • 87b29b7 server: add migrations for PluginKeyValueStore model
  • 76a3e09 plugin-engine: initial implementation of plugin support
  • 3aab826 server: implementation of ServerBackendAPI for plugin engine
  • af9d367 server: implement PluginBackendHandler
  • be503db server: initial configuration blocks for plugins
  • a04b6fc server: wire up and use PluginBackendHandler
  • ce57c14 plugins: a few sample plugin files with experiments

📊 Changes

107 files changed (+8309 additions, -1038 deletions)

View changed files

📝 Cargo.lock (+753 -59)
📝 Cargo.toml (+3 -0)
📝 crates/domain-handlers/src/handler.rs (+24 -0)
📝 crates/domain-model/src/model/mod.rs (+2 -0)
crates/domain-model/src/model/plugin_key_values.rs (+31 -0)
📝 crates/domain-model/src/model/prelude.rs (+2 -0)
📝 crates/domain/src/types.rs (+3 -3)
crates/key-value-store/Cargo.toml (+22 -0)
crates/key-value-store/src/api/error.rs (+26 -0)
crates/key-value-store/src/api/mod.rs (+2 -0)
crates/key-value-store/src/api/store.rs (+29 -0)
crates/key-value-store/src/lib.rs (+1 -0)
crates/plugin-engine/Cargo.toml (+77 -0)
crates/plugin-engine/plugins (+1 -0)
crates/plugin-engine/src/api/arguments/ldap_bind_result.rs (+21 -0)
crates/plugin-engine/src/api/arguments/ldap_search_result.rs (+10 -0)
crates/plugin-engine/src/api/arguments/mod.rs (+2 -0)
crates/plugin-engine/src/api/backend.rs (+70 -0)
crates/plugin-engine/src/api/handler.rs (+184 -0)
crates/plugin-engine/src/api/mod.rs (+4 -0)

...and 80 more files

📄 Description

Initial work on providing support for plugins written in Lua for LLDAP.

Feel free to leave comments or suggestions. Would appreciate if any bigger structural refactorings could be done before I dig deeper in the current direction. I would suggest going on a per-commit basis when reviewing.

State:
Currently in a working state, but still very much a work in progress. Plugins can be included in the configuration, they will be initialized on start up, and all implemented listeners should be functional at this point.

Non-exhaustive TODO list:

  • Implement event handlers for get_users, get_groups, and other remaining BackendHandler methods.
  • Handling of failing plugin handlers. Currently fails silently. Configurable block-on-failure/on-error-resume-next?
  • Change filters for list_users/list_groups to an AST instead of LDAP filter string.
  • Figure out if plugins should be triggered by actions caused by plugins.
  • Support some kind of plugin api-version check.
  • Make chosen stdlib level explicit in Lua environment
  • Propagate a Result from Lua environment setup
  • Clean up sorting of registered event handlers a bit.
  • Finalize configuration format
  • Tests, many more tests...

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/lldap/lldap/pull/1119 **Author:** [@broeng](https://github.com/broeng) **Created:** 2/28/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `plugin-support` --- ### 📝 Commits (10+) - [`2b5852e`](https://github.com/lldap/lldap/commit/2b5852e62feb8e6703c5d2fce648a55efd33700e) handlers: provide RequestContext with userinfo to handlers - [`72909ba`](https://github.com/lldap/lldap/commit/72909ba0bc39f9fe736c6182eb61af0d10c3b53d) crate: adds a KeyValueStore trait with a new crate - [`4d3614a`](https://github.com/lldap/lldap/commit/4d3614a6b305cc28602b7b83293533db3e4833db) crate: add PluginKeyValueStore with DB model - [`87b29b7`](https://github.com/lldap/lldap/commit/87b29b7ff7fd776d6e267b42b556cf06624c6dd8) server: add migrations for PluginKeyValueStore model - [`76a3e09`](https://github.com/lldap/lldap/commit/76a3e09a052b2064825312840cd2bf8fe8289135) plugin-engine: initial implementation of plugin support - [`3aab826`](https://github.com/lldap/lldap/commit/3aab826c62447330eda9af7bb82f96e8c4f455d5) server: implementation of ServerBackendAPI for plugin engine - [`af9d367`](https://github.com/lldap/lldap/commit/af9d367cbc03e4721e9cd8742c6616948a724855) server: implement PluginBackendHandler - [`be503db`](https://github.com/lldap/lldap/commit/be503dbf120e2b02dee3211e8a6f6434f18caec9) server: initial configuration blocks for plugins - [`a04b6fc`](https://github.com/lldap/lldap/commit/a04b6fcf03e0ee6bb08ce73b1b3adf6a924c643f) server: wire up and use PluginBackendHandler - [`ce57c14`](https://github.com/lldap/lldap/commit/ce57c14d955a3ad050b7a3f560db70e2a38fd419) plugins: a few sample plugin files with experiments ### 📊 Changes **107 files changed** (+8309 additions, -1038 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+753 -59) 📝 `Cargo.toml` (+3 -0) 📝 `crates/domain-handlers/src/handler.rs` (+24 -0) 📝 `crates/domain-model/src/model/mod.rs` (+2 -0) ➕ `crates/domain-model/src/model/plugin_key_values.rs` (+31 -0) 📝 `crates/domain-model/src/model/prelude.rs` (+2 -0) 📝 `crates/domain/src/types.rs` (+3 -3) ➕ `crates/key-value-store/Cargo.toml` (+22 -0) ➕ `crates/key-value-store/src/api/error.rs` (+26 -0) ➕ `crates/key-value-store/src/api/mod.rs` (+2 -0) ➕ `crates/key-value-store/src/api/store.rs` (+29 -0) ➕ `crates/key-value-store/src/lib.rs` (+1 -0) ➕ `crates/plugin-engine/Cargo.toml` (+77 -0) ➕ `crates/plugin-engine/plugins` (+1 -0) ➕ `crates/plugin-engine/src/api/arguments/ldap_bind_result.rs` (+21 -0) ➕ `crates/plugin-engine/src/api/arguments/ldap_search_result.rs` (+10 -0) ➕ `crates/plugin-engine/src/api/arguments/mod.rs` (+2 -0) ➕ `crates/plugin-engine/src/api/backend.rs` (+70 -0) ➕ `crates/plugin-engine/src/api/handler.rs` (+184 -0) ➕ `crates/plugin-engine/src/api/mod.rs` (+4 -0) _...and 80 more files_ </details> ### 📄 Description Initial work on providing support for plugins written in Lua for LLDAP. Feel free to leave comments or suggestions. Would appreciate if any bigger structural refactorings could be done before I dig deeper in the current direction. I would suggest going on a per-commit basis when reviewing. State: Currently in a working state, but still very much a work in progress. Plugins can be included in the configuration, they will be initialized on start up, and all implemented listeners should be functional at this point. Non-exhaustive TODO list: - [x] Implement event handlers for get_users, get_groups, and other remaining BackendHandler methods. - [ ] Handling of failing plugin handlers. Currently fails silently. Configurable block-on-failure/on-error-resume-next? - [x] Change filters for list_users/list_groups to an AST instead of LDAP filter string. - [ ] Figure out if plugins should be triggered by actions caused by plugins. - [ ] Support some kind of plugin api-version check. - [x] Make chosen stdlib level explicit in Lua environment - [x] Propagate a Result from Lua environment setup - [x] Clean up sorting of registered event handlers a bit. - [x] Finalize configuration format - [ ] Tests, many more tests... --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/lldap-lldap#1133
No description provided.