public function canAccess()
    {
        // Admin can access everything, no point in checking.
        $member = Security::getCurrentUser();
        if ($member
            && (Permission::checkMember($member, [
                'ADMIN', // Full administrative rights
                'CMS_ACCESS_LeftAndMain', // Access to all CMS sections
                'CMS_ACCESS_CMSMain', // Access to CMS controllers
            ]))
        ) {
            return true;
        }

        // Check if we have access to current section on the current subsite.
        $accessibleSites = $this->owner->sectionSites(true, 'Main site', $member);
        return $accessibleSites->count() && $accessibleSites->find('ID', SubsiteState::singleton()->getSubsiteId());
    }
public function canAccess()
    {
        // Admin can access everything, no point in checking.
        $member = Security::getCurrentUser();
        if ($member
            && (Permission::checkMember($member, [
                'ADMIN', // Full administrative rights
                'CMS_ACCESS_LeftAndMain', // Access to all CMS sections
                'CMS_ACCESS_CMSMain', // Access to CMS controllers
            ]))
        ) {
            return true;
        }

        // Check if we have access to current section on the current subsite.
        $accessibleSites = $this->owner->sectionSites(true, 'Main site', $member);
        return $accessibleSites->count() && $accessibleSites->find('ID', SubsiteState::singleton()->getSubsiteId());
    }
public function canAccess ( ) { // Admin can access everything, no point in checking. $ member = Security :: getCurrentUser ( ) ; if ( $ member && ( Permission :: checkMember ( $ member , [ 'ADMIN' , // Full administrative rights 'CMS_ACCESS_LeftAndMain' , // Access to all CMS sections 'CMS_ACCESS_CMSMain' , // Access to CMS controllers ] ) ) ) { return true ; } // Check if we have access to current section on the current subsite. $ accessibleSites = $ this -> owner -> sectionSites ( true , 'Main site' , $ member ) ; return $ accessibleSites -> count ( ) && $ accessibleSites -> find ( 'ID' , SubsiteState :: singleton ( ) -> getSubsiteId ( ) ) ; }
Check if the current controller is accessible for this user on this subsite.
Check if the current controller is accessible for this user on this subsite .