So I want to retrieve the group name of a users primary group.
I already know how to retrieve the primaryGroupID but I haven't found a field in the group class, that holds such an id.
Thats how I retrieve the primaryGroupID:
$filter = "(sAMAccountName=" . $username . ")";
$attr = array ( "primaryGroupID", "sAMAccountName" );
$result = ldap_search( $ldap, "DC=ad,DC=test,DC=local", $filter, $attr ) or exit( "Unable to search LDAP server" . ldap_error( $ldap ) );
$entries = ldap_get_entries( $ldap, $result );
Thanks in advance!