app/Fact.php
public function canShow(int $access_level = null): bool
    {
        if ($access_level === null) {
            $access_level = Auth::accessLevel($this->record()->tree());
        }

        // Does this record have an explicit RESN?
        if (strpos($this->gedcom, "\n2 RESN confidential") !== false) {
            return Auth::PRIV_NONE >= $access_level;
        }
        if (strpos($this->gedcom, "\n2 RESN privacy") !== false) {
            return Auth::PRIV_USER >= $access_level;
        }
        if (strpos($this->gedcom, "\n2 RESN none") !== false) {
            return true;
        }

        // Does this record have a default RESN?
        $xref                    = $this->record->xref();
        $fact_privacy            = $this->record->tree()->getFactPrivacy();
        $individual_fact_privacy = $this->record->tree()->getIndividualFactPrivacy();
        if (isset($individual_fact_privacy[$xref][$this->tag])) {
            return $individual_fact_privacy[$xref][$this->tag] >= $access_level;
        }
        if (isset($fact_privacy[$this->tag])) {
            return $fact_privacy[$this->tag] >= $access_level;
        }

        // No restrictions - it must be public
        return true;
    }
public function canShow(int $access_level = null): bool
    {
        if ($access_level === null) {
            $access_level = Auth::accessLevel($this->record()->tree());
        }

        // Does this record have an explicit RESN?
        if (strpos($this->gedcom, "\n2 RESN confidential") !== false) {
            return Auth::PRIV_NONE >= $access_level;
        }
        if (strpos($this->gedcom, "\n2 RESN privacy") !== false) {
            return Auth::PRIV_USER >= $access_level;
        }
        if (strpos($this->gedcom, "\n2 RESN none") !== false) {
            return true;
        }

        // Does this record have a default RESN?
        $xref                    = $this->record->xref();
        $fact_privacy            = $this->record->tree()->getFactPrivacy();
        $individual_fact_privacy = $this->record->tree()->getIndividualFactPrivacy();
        if (isset($individual_fact_privacy[$xref][$this->tag])) {
            return $individual_fact_privacy[$xref][$this->tag] >= $access_level;
        }
        if (isset($fact_privacy[$this->tag])) {
            return $fact_privacy[$this->tag] >= $access_level;
        }

        // No restrictions - it must be public
        return true;
    }
public function canShow ( int $ access_level = null ) : bool { if ( $ access_level === null ) { $ access_level = Auth :: accessLevel ( $ this -> record ( ) -> tree ( ) ) ; } // Does this record have an explicit RESN? if ( strpos ( $ this -> gedcom , "\n2 RESN confidential" ) !== false ) { return Auth :: PRIV_NONE >= $ access_level ; } if ( strpos ( $ this -> gedcom , "\n2 RESN privacy" ) !== false ) { return Auth :: PRIV_USER >= $ access_level ; } if ( strpos ( $ this -> gedcom , "\n2 RESN none" ) !== false ) { return true ; } // Does this record have a default RESN? $ xref = $ this -> record -> xref ( ) ; $ fact_privacy = $ this -> record -> tree ( ) -> getFactPrivacy ( ) ; $ individual_fact_privacy = $ this -> record -> tree ( ) -> getIndividualFactPrivacy ( ) ; if ( isset ( $ individual_fact_privacy [ $ xref ] [ $ this -> tag ] ) ) { return $ individual_fact_privacy [ $ xref ] [ $ this -> tag ] >= $ access_level ; } if ( isset ( $ fact_privacy [ $ this -> tag ] ) ) { return $ fact_privacy [ $ this -> tag ] >= $ access_level ; } // No restrictions - it must be public return true ; }
Do the privacy rules allow us to display this fact to the current user

@param int|null $access_level

@return bool
Do the privacy rules allow us to display this fact to the current user