mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-11-04 03:08:25 +00:00 
			
		
		
		
	implement acl in query
This commit is contained in:
		@@ -62,12 +62,18 @@ class CountPerson implements ExportInterface
 | 
			
		||||
     * @param QueryBuilder $qb
 | 
			
		||||
     * @return QueryBuilder
 | 
			
		||||
     */
 | 
			
		||||
    public function initiateQuery(QueryBuilder $qb, array $requiredModifiers)
 | 
			
		||||
    public function initiateQuery(QueryBuilder $qb, array $requiredModifiers, $acl)
 | 
			
		||||
    {
 | 
			
		||||
        $centers = array_map(function($el) { return $el['center']; }, $acl);
 | 
			
		||||
        
 | 
			
		||||
        $qb->select('COUNT(person.id) AS export_result')
 | 
			
		||||
                ->from('ChillPersonBundle:Person', 'person')
 | 
			
		||||
                ->join('person.center', 'center')
 | 
			
		||||
                ->andWhere('center IN (:authorized_centers)')
 | 
			
		||||
                ->setParameter('authorized_centers', $centers);
 | 
			
		||||
                ;
 | 
			
		||||
        
 | 
			
		||||
        
 | 
			
		||||
        return $qb;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user