fisharebest / webtrees

Online genealogy
https://webtrees.net
GNU General Public License v3.0
464 stars 299 forks source link

Family pages throwing "forbidden" errors when some of the family members are private #5041

Open mpaluchowski opened 2 days ago

mpaluchowski commented 2 days ago

There's an issue, or at least an inconsistency, in how family pages are made available when some of the family records are private. For example, consider this family list. The first three entries have its first partner listed as "Private" (correctly), but when the link is clicked, the page returns an error of "This family does not exist or you do not have permission to view it."

Either:

This is causing an issue with search engines reporting indexing issues when they encounter links to content that is triggering errors. I keep getting emails from Google every other week about this.

I suspect this might be a bug with handling privacy settings on the family page. For reproduction purposes, my settings are to show living individuals only to members, and show deceased ones publicly only 5 years after their death.

I also have the following privacy restrictions:

image

FrankWarius commented 2 days ago

we had this discussion last year #4584

I changed my personal webtrees installation in app\family.php function canShowByType

  1. version: remove CHIL (child) in line 154:
    preg_match_all('/\n1 (?:HUSB|WIFE) @(' . Gedcom::REGEX_XREF . ')@/', $this->gedcom, $matches); this shows the family page if all parents are not private, children are vissilble if they are not private

  2. version. recently i changed it again line 151 ff

    protected`` function canShowByType(int $access_level): bool
    {`
        // Don't hHide a family if one member is not private
        preg_match_all('/\n1 (?:CHIL|HUSB|WIFE) @(' . Gedcom::REGEX_XREF . ')@/', $this->gedcom, $matches);
        foreach ($matches[1] as $match) {
            $person = Registry::individualFactory()->make($match, $this->tree);
            if ($person->canShow($access_level)) {
                return true;
            }
        }
        return false;
    }

    this shows the family if one member is not private

mpaluchowski commented 2 days ago

I see. @fisharebest seems to have his reasons to keep these family pages from being displayed. I can accept that, but if that's the way it's supposed to be, can we remove the links to those family pages from other pages that are publicly available?

Like said, the current state causes Google and other search engines to complain about the website's quality, and keep reporting indexing errors. The principle is that there should be no public links to pages returning 4xx erorrs – 403 in the case discussed here.