public static function ConversionHelper::convertMsguidToString in Lightweight Directory Access Protocol (LDAP) 8.3
Same name and namespace in other branches
- 8.4 ldap_servers/src/Helper/ConversionHelper.php \Drupal\ldap_servers\Helper\ConversionHelper::convertMsguidToString()
Function to convert microsoft style guids to strings.
Parameters
string $value: Value to convert.
Return value
string Converted value.
3 calls to ConversionHelper::convertMsguidToString()
- ConversionHelper::binaryConversionToString in ldap_servers/
src/ Helper/ ConversionHelper.php - General binary conversion function for GUID.
- ConversionHelper::convertAttribute in ldap_servers/
src/ Helper/ ConversionHelper.php - Converts an attribute by their format.
- TokenTests::testTokenReplacement in ldap_servers/
tests/ src/ Unit/ TokenTests.php - Test the replacement of tokens.
File
- ldap_servers/
src/ Helper/ ConversionHelper.php, line 304
Class
- ConversionHelper
- Conversion helper to escape values correctly for LDAP filters.
Namespace
Drupal\ldap_servers\HelperCode
public static function convertMsguidToString($value) {
$hex_string = bin2hex($value);
// (MS?) GUID are displayed with first three GUID parts as "big endian"
// Doing this so String value matches what other LDAP tool displays for AD.
$value = strtoupper(substr($hex_string, 6, 2) . substr($hex_string, 4, 2) . substr($hex_string, 2, 2) . substr($hex_string, 0, 2) . '-' . substr($hex_string, 10, 2) . substr($hex_string, 8, 2) . '-' . substr($hex_string, 14, 2) . substr($hex_string, 12, 2) . '-' . substr($hex_string, 16, 4) . '-' . substr($hex_string, 20, 12));
return $value;
}