added function to extract RDN value

This commit is contained in:
Roland Gruber 2012-11-25 17:04:01 +00:00
parent 1ebed3d86d
commit 1270ae4e40
1 changed files with 12 additions and 0 deletions

View File

@ -876,6 +876,18 @@ function extractRDNAttribute($dn) {
return $parts[0]; return $parts[0];
} }
/**
* Extracts the RDN attribute value from a given DN.
*
* @param String $dn DN
* @return String RDN attribute value
*/
function extractRDNValue($dn) {
if ($dn == null) return null;
$parts = explode("=", substr($dn, 0, strpos($dn, ',')));
return $parts[1];
}
/** /**
* Extracts the DN suffix from a given DN. * Extracts the DN suffix from a given DN.
* E.g. ou=people,dc=test,dc=com will result in dc=test,dc=com. * E.g. ou=people,dc=test,dc=com will result in dc=test,dc=com.