protected function checkAllAccess($action, $limit)
    {
        /** @var ContactSourceModel $model */
        $model = $this->getModel('contactSource');

        //make sure the user has view access to contactSources
        $repo = $model->getRepository();

        // order by lastactive, filter
        $contactSources = $repo->getEntities(
            [
                'filter'         => [],
                'oderBy'         => 'r.last_active',
                'orderByDir'     => 'DESC',
                'limit'          => $limit,
                'hydration_mode' => 'HYDRATE_ARRAY',
            ]
        );

        if (null === $contactSources) {
            return $this->accessDenied();
        }

        foreach ($contactSources as $contactSource) {
            if (!$this->get('mautic.security')->hasEntityAccess(
                'contactsource:items:'.$action.'own',
                'contactsource:items:'.$action.'other',
                $contactSource['createdBy']
            )
            ) {
                unset($contactSource);
            }
        }

        return $contactSources;
    }
protected function checkAllAccess($action, $limit)
    {
        /** @var ContactSourceModel $model */
        $model = $this->getModel('contactSource');

        //make sure the user has view access to contactSources
        $repo = $model->getRepository();

        // order by lastactive, filter
        $contactSources = $repo->getEntities(
            [
                'filter'         => [],
                'oderBy'         => 'r.last_active',
                'orderByDir'     => 'DESC',
                'limit'          => $limit,
                'hydration_mode' => 'HYDRATE_ARRAY',
            ]
        );

        if (null === $contactSources) {
            return $this->accessDenied();
        }

        foreach ($contactSources as $contactSource) {
            if (!$this->get('mautic.security')->hasEntityAccess(
                'contactsource:items:'.$action.'own',
                'contactsource:items:'.$action.'other',
                $contactSource['createdBy']
            )
            ) {
                unset($contactSource);
            }
        }

        return $contactSources;
    }
protected function checkAllAccess ( $ action , $ limit ) { /** @var ContactSourceModel $model */ $ model = $ this -> getModel ( 'contactSource' ) ; //make sure the user has view access to contactSources $ repo = $ model -> getRepository ( ) ; // order by lastactive, filter $ contactSources = $ repo -> getEntities ( [ 'filter' => [ ] , 'oderBy' => 'r.last_active' , 'orderByDir' => 'DESC' , 'limit' => $ limit , 'hydration_mode' => 'HYDRATE_ARRAY' , ] ) ; if ( null === $ contactSources ) { return $ this -> accessDenied ( ) ; } foreach ( $ contactSources as $ contactSource ) { if ( ! $ this -> get ( 'mautic.security' ) -> hasEntityAccess ( 'contactsource:items:' . $ action . 'own' , 'contactsource:items:' . $ action . 'other' , $ contactSource [ 'createdBy' ] ) ) { unset ( $ contactSource ) ; } } return $ contactSources ; }
Returns contactSources the user has access to.

@param $action

@return array|\Symfony\Component\HttpFoundation\RedirectResponse
Returns contactSources the user has access to .