public function isGrantedForElement(ExportElementInterface $element, ExportInterface $export = NULL, array $centers = null)
    {
        if ($element instanceof ExportInterface) {
            $role = $element->requiredRole();
        } elseif ($element instanceof ModifierInterface ) {
            if (is_null($element->addRole())) {
                if (is_null($export)) {
                    throw new \LogicException("The export should not be null: as the "
                            . "ModifierInstance element is not an export, we should "
                            . "be aware of the export to determine which role is required");
                } else {
                    $role = $export->requiredRole();
                }
            } else {
                $role = $element->addRole();
            }
        } else {
            throw new \LogicException("The element is not an ModifiersInterface or "
                    . "an ExportInterface.");
        }
        
        if ($centers === null) {
            $centers = $this->authorizationHelper->getReachableCenters($this->user, 
                            $role);
        }
        
        if (count($centers) === 0) {
            return false;
        }
        
        foreach($centers as $center) {
            if ($this->authorizationChecker->isGranted($role->getRole(), $center) === false) {
                //debugging
                $this->logger->debug('user has no access to element', array(
                    'method' => __METHOD__,  
                    'type' => get_class($element), 'center' => $center->getName()
                ));
                
                return false;
            }
        }
        
        return true;
    }
public function isGrantedForElement(ExportElementInterface $element, ExportInterface $export = NULL, array $centers = null)
    {
        if ($element instanceof ExportInterface) {
            $role = $element->requiredRole();
        } elseif ($element instanceof ModifierInterface ) {
            if (is_null($element->addRole())) {
                if (is_null($export)) {
                    throw new \LogicException("The export should not be null: as the "
                            . "ModifierInstance element is not an export, we should "
                            . "be aware of the export to determine which role is required");
                } else {
                    $role = $export->requiredRole();
                }
            } else {
                $role = $element->addRole();
            }
        } else {
            throw new \LogicException("The element is not an ModifiersInterface or "
                    . "an ExportInterface.");
        }
        
        if ($centers === null) {
            $centers = $this->authorizationHelper->getReachableCenters($this->user, 
                            $role);
        }
        
        if (count($centers) === 0) {
            return false;
        }
        
        foreach($centers as $center) {
            if ($this->authorizationChecker->isGranted($role->getRole(), $center) === false) {
                //debugging
                $this->logger->debug('user has no access to element', array(
                    'method' => __METHOD__,  
                    'type' => get_class($element), 'center' => $center->getName()
                ));
                
                return false;
            }
        }
        
        return true;
    }
public function isGrantedForElement ( ExportElementInterface $ element , ExportInterface $ export = NULL , array $ centers = null ) { if ( $ element instanceof ExportInterface ) { $ role = $ element -> requiredRole ( ) ; } elseif ( $ element instanceof ModifierInterface ) { if ( is_null ( $ element -> addRole ( ) ) ) { if ( is_null ( $ export ) ) { throw new \ LogicException ( "The export should not be null: as the " . "ModifierInstance element is not an export, we should " . "be aware of the export to determine which role is required" ) ; } else { $ role = $ export -> requiredRole ( ) ; } } else { $ role = $ element -> addRole ( ) ; } } else { throw new \ LogicException ( "The element is not an ModifiersInterface or " . "an ExportInterface." ) ; } if ( $ centers === null ) { $ centers = $ this -> authorizationHelper -> getReachableCenters ( $ this -> user , $ role ) ; } if ( count ( $ centers ) === 0 ) { return false ; } foreach ( $ centers as $ center ) { if ( $ this -> authorizationChecker -> isGranted ( $ role -> getRole ( ) , $ center ) === false ) { //debugging $ this -> logger -> debug ( 'user has no access to element' , array ( 'method' => __METHOD__ , 'type' => get_class ( $ element ) , 'center' => $ center -> getName ( ) ) ) ; return false ; } } return true ; }
Return true if the current user has access to the ExportElement for every
center, false if the user hasn't access to element for at least one center.

@param \Chill\MainBundle\Export\ExportElementInterface $element
@param array|null $centers, if null, the function take into account all the reachables centers for the current user and the role given by element::requiredRole
@return boolean
Return true if the current user has access to the ExportElement for every center false if the user hasn t access to element for at least one center .