protected function checkUserSecurity()
    {
        $allowedGroup = $this->property('security', self::ALLOW_ALL);
        $allowedUserGroups = $this->property('allowedUserGroups', []);
        $isAuthenticated = Auth::check();

        if ($isAuthenticated) {
            if ($allowedGroup == self::ALLOW_GUEST) {
                return false;
            }

            if (!empty($allowedUserGroups)) {
                $userGroups = Auth::getUser()->groups->lists('code');
                if (!count(array_intersect($allowedUserGroups, $userGroups))) {
                    return false;
                }
            }
        }
        else {
            if ($allowedGroup == self::ALLOW_USER) {
                return false;
            }
        }

        return true;
    }
protected function checkUserSecurity()
    {
        $allowedGroup = $this->property('security', self::ALLOW_ALL);
        $allowedUserGroups = $this->property('allowedUserGroups', []);
        $isAuthenticated = Auth::check();

        if ($isAuthenticated) {
            if ($allowedGroup == self::ALLOW_GUEST) {
                return false;
            }

            if (!empty($allowedUserGroups)) {
                $userGroups = Auth::getUser()->groups->lists('code');
                if (!count(array_intersect($allowedUserGroups, $userGroups))) {
                    return false;
                }
            }
        }
        else {
            if ($allowedGroup == self::ALLOW_USER) {
                return false;
            }
        }

        return true;
    }
protected function checkUserSecurity ( ) { $ allowedGroup = $ this -> property ( 'security' , self :: ALLOW_ALL ) ; $ allowedUserGroups = $ this -> property ( 'allowedUserGroups' , [ ] ) ; $ isAuthenticated = Auth :: check ( ) ; if ( $ isAuthenticated ) { if ( $ allowedGroup == self :: ALLOW_GUEST ) { return false ; } if ( ! empty ( $ allowedUserGroups ) ) { $ userGroups = Auth :: getUser ( ) -> groups -> lists ( 'code' ) ; if ( ! count ( array_intersect ( $ allowedUserGroups , $ userGroups ) ) ) { return false ; } } } else { if ( $ allowedGroup == self :: ALLOW_USER ) { return false ; } } return true ; }
Checks if the user can access this page based on the security rules
@return bool
Checks if the user can access this page based on the security rules