Skip to content

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

  1. Install and configure the LDAP and LDAP User modules.
  2. Enable the Knowledge LDAP module:
  3. Extend (/admin/modules) → enable Knowledge LDAP integration
  4. 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

  1. LDAP user sync: When ldap_user processes a user (create or update), it invokes hook_ldap_user_edit_user_alter().
  2. Leader lookup: The Knowledge LDAP module's LdapLeaderService reads the configured leader token from the LDAP entry and resolves it to a DN.
  3. User resolution: The service looks up the Drupal user with that LDAP DN (ldap_user_current_dn).
  4. Field update: If a matching user exists and differs from the current leader, the knowledge_leader field 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_dn set.
  • LDAP module errors: Ensure LDAP Servers and LDAP User are configured and syncing users successfully before enabling Knowledge LDAP.

See Also