src/Models/Tile.php
/**
     * This function should return true if the current user can view this
     * page. It can be overloaded to customise the security model for an
     * application.
     *
     * Denies permission if any of the following conditions is TRUE:
     * - canView() on any extension returns FALSE
     * - "CanViewType" directive is set to "Inherit" and any parent page return false for canView()
     * - "CanViewType" directive is set to "LoggedInUsers" and no user is logged in
     * - "CanViewType" directive is set to "OnlyTheseUsers" and user is not in the given groups
     *
     * @uses DataExtension->canView()
     * @uses ViewerGroups()
     *
     * @param Member|int|null $member
     * @return boolean True if the current user can view this page.
     */
This function should return true if the current user can view this
page. It can be overloaded to customise the security model for an
application.





@param Member|int|null $member
@return boolean True if the current user can view this page.
This function should return true if the current user can view this page . It can be overloaded to customise the security model for an application . @param Member|int|null $member @return boolean True if the current user can view this page .
public function canView($member = null)
    {
        if (!$member || !(is_a($member, 'Member')) || is_numeric($member)) {
            $member = Security::getCurrentUser();
        }
        if ($member && Permission::checkMember($member, array("ADMIN", "SITETREE_VIEW_ALL"))) {
            return true;
        }
        $extended = $this->extendedCan('canView', $member);
        if ($extended !== null) {
            return $extended;
        }
        if (!$this->CanViewType || $this->CanViewType == 'Anyone') {
            return true;
        }
        if ($this->CanViewType == 'LoggedInUsers' && $member) {
            return true;
        }
        if ($member && is_numeric($member)) {
            $member = DataObject::get_by_id(Member::class, $member);
        }
        if (
            $this->CanViewType == 'OnlyTheseUsers' && $member && $member->inGroups($this->ViewerGroups())
        ) {
            return true;
        }
        return false;
    }
public function canView ( $ member = null ) { if ( ! $ member || ! ( is_a ( $ member , 'Member' ) ) || is_numeric ( $ member ) ) { $ member = Security :: getCurrentUser ( ) ; } if ( $ member && Permission :: checkMember ( $ member , array ( " ADMIN " , " SITETREE_VIEW_ALL " ) ) ) { return true ; } $ extended = $ this -> extendedCan ( 'canView' , $ member ) ; if ( $ extended !== null ) { return $ extended ; } if ( ! $ this -> CanViewType || $ this -> CanViewType == 'Anyone' ) { return true ; } if ( $ this -> CanViewType == 'LoggedInUsers' && $ member ) { return true ; } if ( $ member && is_numeric ( $ member ) ) { $ member = DataObject :: get_by_id ( Member :: class , $ member ) ; } if ( $ this -> CanViewType == 'OnlyTheseUsers' && $ member && $ member -> inGroups ( $ this -> ViewerGroups ( ) ) ) { return true ; } return false ; }
This function should return true if the current user can view this
 page.
This function should return true if the current user can view this page .
// admin override // Standard mechanism for accepting permission changes from extensions // check for empty spec // check for any logged-in users // check for specific groups // echo $this->ID."<br>";