public function canView($member = null)
    {
        if (!$member) {
            $member = Security::getCurrentUser();
        }

        // Standard mechanism for accepting permission changes from extensions
        $extended = $this->extendedCan('canView', $member);
        if ($extended !== null) {
            return $extended;
        }

        // admin override
        if ($member && Permission::checkMember($member, array("ADMIN", "SITETREE_VIEW_ALL"))) {
            return true;
        }

        // Orphaned pages (in the current stage) are unavailable, except for admins via the CMS
        if ($this->isOrphaned()) {
            return false;
        }

        // Note: getInheritedPermissions() is disused in this instance
        // to allow parent canView extensions to influence subpage canView()

        // check for empty spec
        if (!$this->CanViewType || $this->CanViewType === InheritedPermissions::ANYONE) {
            return true;
        }

        // check for inherit
        if ($this->CanViewType === InheritedPermissions::INHERIT) {
            if ($this->ParentID) {
                return $this->Parent()->canView($member);
            } else {
                return $this->getSiteConfig()->canViewPages($member);
            }
        }

        // check for any logged-in users
        if ($this->CanViewType === InheritedPermissions::LOGGED_IN_USERS && $member && $member->ID) {
            return true;
        }

        // check for specific groups
        if ($this->CanViewType === InheritedPermissions::ONLY_THESE_USERS
            && $member
            && $member->inGroups($this->ViewerGroups())
        ) {
            return true;
        }

        return false;
    }
public function canView($member = null)
    {
        if (!$member) {
            $member = Security::getCurrentUser();
        }

        // Standard mechanism for accepting permission changes from extensions
        $extended = $this->extendedCan('canView', $member);
        if ($extended !== null) {
            return $extended;
        }

        // admin override
        if ($member && Permission::checkMember($member, array("ADMIN", "SITETREE_VIEW_ALL"))) {
            return true;
        }

        // Orphaned pages (in the current stage) are unavailable, except for admins via the CMS
        if ($this->isOrphaned()) {
            return false;
        }

        // Note: getInheritedPermissions() is disused in this instance
        // to allow parent canView extensions to influence subpage canView()

        // check for empty spec
        if (!$this->CanViewType || $this->CanViewType === InheritedPermissions::ANYONE) {
            return true;
        }

        // check for inherit
        if ($this->CanViewType === InheritedPermissions::INHERIT) {
            if ($this->ParentID) {
                return $this->Parent()->canView($member);
            } else {
                return $this->getSiteConfig()->canViewPages($member);
            }
        }

        // check for any logged-in users
        if ($this->CanViewType === InheritedPermissions::LOGGED_IN_USERS && $member && $member->ID) {
            return true;
        }

        // check for specific groups
        if ($this->CanViewType === InheritedPermissions::ONLY_THESE_USERS
            && $member
            && $member->inGroups($this->ViewerGroups())
        ) {
            return true;
        }

        return false;
    }
public function canView ( $ member = null ) { if ( ! $ member ) { $ member = Security :: getCurrentUser ( ) ; } // Standard mechanism for accepting permission changes from extensions $ extended = $ this -> extendedCan ( 'canView' , $ member ) ; if ( $ extended !== null ) { return $ extended ; } // admin override if ( $ member && Permission :: checkMember ( $ member , array ( "ADMIN" , "SITETREE_VIEW_ALL" ) ) ) { return true ; } // Orphaned pages (in the current stage) are unavailable, except for admins via the CMS if ( $ this -> isOrphaned ( ) ) { return false ; } // Note: getInheritedPermissions() is disused in this instance // to allow parent canView extensions to influence subpage canView() // check for empty spec if ( ! $ this -> CanViewType || $ this -> CanViewType === InheritedPermissions :: ANYONE ) { return true ; } // check for inherit if ( $ this -> CanViewType === InheritedPermissions :: INHERIT ) { if ( $ this -> ParentID ) { return $ this -> Parent ( ) -> canView ( $ member ) ; } else { return $ this -> getSiteConfig ( ) -> canViewPages ( $ member ) ; } } // check for any logged-in users if ( $ this -> CanViewType === InheritedPermissions :: LOGGED_IN_USERS && $ member && $ member -> ID ) { return true ; } // check for specific groups if ( $ this -> CanViewType === InheritedPermissions :: ONLY_THESE_USERS && $ member && $ member -> inGroups ( $ this -> ViewerGroups ( ) ) ) { return true ; } return false ; }
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 $member
@return bool 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 .