Knowledge LDAP Module
The Knowledge LDAP module integrates LDAP directory services with the Knowledge module to automatically assign leaders (coaches) to users based on LDAP attributes. When users are synced from LDAP, their knowledge_leader field is populated from the configured leader attribute in the directory.
Overview
This optional submodule uses the LDAP User module to hook into user synchronization. When an LDAP user is created or updated, the module reads the leader attribute from the LDAP entry and sets the corresponding Drupal user as the knowledge leader for that account.
Requirements
- Drupal: 10.3+ or 11+ or 12+
- Dependencies:
- Main Knowledge module
- LDAP User module (requires LDAP, LDAP Servers, etc.)
Installation
- Install and configure the LDAP and LDAP User modules.
- Enable the Knowledge LDAP module:
- Extend (
/admin/modules) → enable Knowledge LDAP integration - Or via Drush:
drush en knowledge_ldap -y
Configuration
Navigate to Configuration > Knowledge > LDAP (/admin/config/knowledge/ldap).
Leader Token
- Leader Token: The LDAP attribute name used to identify the user's leader
- Default:
manager - The value is used as a token replacement pattern (e.g.
[manager]) to look up the leader's distinguished name (DN) in the LDAP entry - Set this to match the attribute in your LDAP directory that stores the manager or coach reference
Example: If your LDAP stores the manager as manager (pointing to another user's DN), the default manager token will work. For custom attributes, enter the attribute name (e.g. supervisor, directReport).
How It Works
- LDAP user sync: When
ldap_userprocesses a user (create or update), it invokeshook_ldap_user_edit_user_alter(). - Leader lookup: The Knowledge LDAP module's
LdapLeaderServicereads the configured leader token from the LDAP entry and resolves it to a DN. - User resolution: The service looks up the Drupal user with that LDAP DN (
ldap_user_current_dn). - Field update: If a matching user exists and differs from the current leader, the
knowledge_leaderfield on the synced user is updated.
The leader is used by the competency system as the coach who can propose users for role promotions (e.g. Candidate → Contributor → Publisher).
Services
knowledge_ldap.leader
- Interface:
Drupal\knowledge_ldap\KnowledgeLdapLeaderInterface - Class:
Drupal\knowledge_ldap\Service\LdapLeaderService
Updates the knowledge_leader field on a user based on the LDAP entry. Called automatically during LDAP user sync.
Hooks
hook_ldap_user_edit_user_alter()
Implemented by Knowledge LDAP to update the leader field when an LDAP user is synced. The module does not define additional hooks for other modules.
Troubleshooting
- Leader not updating: Verify the Leader Token matches the attribute name in your LDAP directory. Check that the leader's DN resolves to an existing Drupal user with
ldap_user_current_dnset. - LDAP module errors: Ensure LDAP Servers and LDAP User are configured and syncing users successfully before enabling Knowledge LDAP.
See Also
- Configuration Guide – Competency and leader settings
- User Guide – Role progression and coach workflow
- LDAP User project