protected function generateGroupIdList()
    {
        $db         = eZDB::instance();
        $userID     = $this->ContentObjectID;
        $userGroups = $db->arrayQuery( "SELECT  c.contentobject_id as id,c.path_string
                                        FROM ezcontentobject_tree  b,
                                             ezcontentobject_tree  c
                                        WHERE b.contentobject_id='$userID' AND
                                              b.parent_node_id = c.node_id
                                        ORDER BY c.contentobject_id  ");
        $pathArray      = array();
        $userGroupArray = array();
        foreach ( $userGroups as $group )
        {
            $pathItems = explode( '/', $group["path_string"] );
            array_pop( $pathItems );
            array_pop( $pathItems );
            foreach ( $pathItems as $pathItem )
            {
                if ( $pathItem != '' && $pathItem > 1 )
                    $pathArray[] = $pathItem;
            }
            $userGroupArray[] = $group['id'];
        }

        if ( !empty( $pathArray ) )
        {
            $pathArray = array_unique ($pathArray);
            $extraGroups = $db->arrayQuery( "SELECT c.contentobject_id as id
                                            FROM ezcontentobject_tree  c,
                                                 ezcontentobject d
                                            WHERE c.node_id in ( " . implode( ', ', $pathArray ) . " ) AND
                                                  d.id = c.contentobject_id
                                            ORDER BY c.contentobject_id  ");
            foreach ( $extraGroups as $group )
            {
                $userGroupArray[] = $group['id'];
            }
        }
        return $userGroupArray;
    }