src/Zicht/Bundle/AdminBundle/Security/Voter/AdminVoter.php
protected function mapAttributesToRoles($class, $attributes)
    {
        $mappedAttributes = array();
        foreach ($this->pool->getAdminClasses() as $adminClass => $adminCodes) {
            if ($class === $adminClass || $class instanceof $adminClass) {
                foreach ($adminCodes as $adminCode) {
                    $admin = $this->pool->getAdminByAdminCode($adminCode);
                    $baseRole = $this->securityHandler->getBaseRole($admin);

                    foreach ($attributes as $attr) {
                        if ($this->supportsAttribute($attr)) {
                            $mappedAttributes[] = sprintf($baseRole, $attr);
                        }
                    }
                }
            }
        }

        return $mappedAttributes;
    }
protected function mapAttributesToRoles($class, $attributes)
    {
        $mappedAttributes = array();
        foreach ($this->pool->getAdminClasses() as $adminClass => $adminCodes) {
            if ($class === $adminClass || $class instanceof $adminClass) {
                foreach ($adminCodes as $adminCode) {
                    $admin = $this->pool->getAdminByAdminCode($adminCode);
                    $baseRole = $this->securityHandler->getBaseRole($admin);

                    foreach ($attributes as $attr) {
                        if ($this->supportsAttribute($attr)) {
                            $mappedAttributes[] = sprintf($baseRole, $attr);
                        }
                    }
                }
            }
        }

        return $mappedAttributes;
    }
protected function mapAttributesToRoles ( $ class , $ attributes ) { $ mappedAttributes = array ( ) ; foreach ( $ this -> pool -> getAdminClasses ( ) as $ adminClass => $ adminCodes ) { if ( $ class === $ adminClass || $ class instanceof $ adminClass ) { foreach ( $ adminCodes as $ adminCode ) { $ admin = $ this -> pool -> getAdminByAdminCode ( $ adminCode ) ; $ baseRole = $ this -> securityHandler -> getBaseRole ( $ admin ) ; foreach ( $ attributes as $ attr ) { if ( $ this -> supportsAttribute ( $ attr ) ) { $ mappedAttributes [ ] = sprintf ( $ baseRole , $ attr ) ; } } } } } return $ mappedAttributes ; }
Maps regular attributes such as VIEW, EDIT, etc, to their respective SONATA role name,
such as ROLE_FOO_BAR_BAZ_EDIT

@param string $class
@param string[] $attributes
@return array
Maps regular attributes such as VIEW EDIT etc to their respective SONATA role name such as ROLE_FOO_BAR_BAZ_EDIT