public static function ConversionHelper::extractTokenAttributes in Lightweight Directory Access Protocol (LDAP) 8.3
Extract token attributes.
@TODO: Do not pass attribute_maps by reference, merge it into an array if really necessary.
Parameters
array $attribute_maps: Array of attribute maps passed by reference. For example: [[<attr_name>, <ordinal>, <data_type>]].
string $text: Text with tokens in it.
5 calls to ConversionHelper::extractTokenAttributes()
- DrupalUserProcessor::alterUserAttributes in ldap_user/
src/ Processor/ DrupalUserProcessor.php - Alter the user's attributes.
- LdapUserAdminForm::validateForm in ldap_user/
src/ Form/ LdapUserAdminForm.php - Form validation handler.
- LdapUserProcessor::extractTokenParts in ldap_user/
src/ Processor/ LdapUserProcessor.php - Extract parts of token.
- ServerFactory::alterLdapAttributes in ldap_servers/
src/ ServerFactory.php - Alter the LDAP attributes.
- SyncMappingHelper::getLdapUserRequiredAttributes in ldap_user/
src/ Helper/ SyncMappingHelper.php - Util to fetch attributes required for this user conf, not other modules.
File
- ldap_servers/
src/ Helper/ ConversionHelper.php, line 272
Class
- ConversionHelper
- Conversion helper to escape values correctly for LDAP filters.
Namespace
Drupal\ldap_servers\HelperCode
public static function extractTokenAttributes(array &$attribute_maps, $text) {
$tokens = self::findTokensNeededForTemplate($text);
foreach ($tokens as $token) {
$token = str_replace([
TokenProcessor::PREFIX,
TokenProcessor::SUFFIX,
], [
'',
'',
], $token);
$parts = explode(TokenProcessor::DELIMITER, $token);
$ordinal = isset($parts[1]) && $parts[1] ? $parts[1] : 0;
$attr_name = $parts[0];
$parts2 = explode(TokenProcessor::MODIFIER_DELIMITER, $attr_name);
if (count($parts2) > 1) {
$attr_name = $parts2[0];
$conversion = $parts2[1];
}
else {
$conversion = NULL;
}
$attribute_maps[$attr_name] = self::setAttributeMap(@$attribute_maps[$attr_name], $conversion, [
$ordinal => NULL,
]);
}
}