feat(provisioning): Add possibility to use LDAP attributes within provisioning templates - #13500
Open
DerDreschner wants to merge 1 commit into
Open
feat(provisioning): Add possibility to use LDAP attributes within provisioning templates#13500DerDreschner wants to merge 1 commit into
DerDreschner wants to merge 1 commit into
Conversation
DerDreschner
requested review from
ChristophWurst,
GretaD and
kesselb
as code owners
August 17, 2026 08:23
…visioning templates Assisted-by: ClaudeCode:claude-fable-5 Signed-off-by: David Dreschner <david.dreschner@nextcloud.com>
DerDreschner
force-pushed
the
feat/provisioning-ldap-placeholder
branch
from
August 17, 2026 09:09
f89f49c to
49c00e5
Compare
ChristophWurst
approved these changes
Aug 18, 2026
kesselb
reviewed
Aug 18, 2026
| */ | ||
| private const LDAP_PLACEHOLDER_PATTERN = '%LDAP:([A-Za-z][A-Za-z0-9-]*)%'; | ||
| private const LDAP_PLACEHOLDER_REGEX = '/' . self::LDAP_PLACEHOLDER_PATTERN . '/'; | ||
| private const LDAP_PLACEHOLDER_ANCHORED_REGEX = '/^' . self::LDAP_PLACEHOLDER_PATTERN . '$/'; |
Contributor
There was a problem hiding this comment.
Claude flagged, that the current regex also matches a trailing newline:
php -r 'var_dump(preg_match("/^[A-Za-z0-9._+@-]{1,64}\$/", "BWAYNE\n"));'
Command line code:1:
int(1)Add D modifier to prevent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
At the moment, only the user id and the mail address attached to the account can be used within provisioning templates. This isn't enough for enterprise use-cases where the LDAP may contain attributes that need to be used within the provisioning template.
To enable that use-case, this PR adds a general
%LDAP:...%placeholder that allows reading any LDAP attribute associated with the user account. Most often, this may be used for accessing thesAMAccountNamevia%LDAP:sAMAccountName%, but I've built it without limitations to that attribute for flexibility. In case the read-request fails (e.g., because the attribute doesn't exist), the placeholder isn't being replaced within the template (same behavior like%EMAIL%).TO-DO
🤖 AI (if applicable)