public function getGroupsAssignedInLdap() {
        if(static::getExtensionOptions('ENABLE_YII2_PROFILING') == true) {
            Yii::beginProfile('getGroupsAssignedInLdap', static::YII2_PROFILE_NAME . 'getGroupsAssignedInLdap');
        }
        
        $ldapUser = $this->queryLdapUserObject();
        
        $ldapGroupsConverted = []; //start with empty array of groups
        
        if ($ldapUser != null) {           
            //check for nested groups?
            if (static::getGroupAssigmentOptions('SEARCH_NESTED_GROUPS',$this->individualGroupAssignmentOptions) == true) {
                //$ldapGroups=$ldapUser->getGroups(['cn'], $recursive=true); //alternate Query, but slower
                //1.2.840.113556.1.4.1941 = Specical OID to resolve chains
                $ldapGroups = static::getAdldapProvider()->search()->rawFilter('(member:1.2.840.113556.1.4.1941:=' . $ldapUser->getDn() . ')')->select('cn')->raw()->get();
                if ($ldapGroups == null) {
                    $ldapGroups = [];
                }
                
                //get cn of each group
                foreach ($ldapGroups as $groupDn) {
                    if (is_array($groupDn) && array_key_exists('cn', $groupDn)) {
                        array_push($ldapGroupsConverted, $groupDn['cn'][0]);
                    }
                }
            } else {
                //get attribute memberof
                $ldapGroups = $ldapUser->getAttribute('memberof');
                if ($ldapGroups == null) {
                    $ldapGroups = [];
                }

                //get first part of dn
                foreach ($ldapGroups as $groupDn) {
                    $n = Utilities::explodeDn($groupDn)[0];
                    array_push($ldapGroupsConverted, $n);
                }
            }
        }

        if(static::getExtensionOptions('ENABLE_YII2_PROFILING') == true) {
            Yii::endProfile('getGroupsAssignedInLdap', static::YII2_PROFILE_NAME . 'getGroupsAssignedInLdap');
        }
        return $ldapGroupsConverted;      
    }