public function getDomainRoles($config)
 {
     if (count($config['security']['domain_list']) == 0) {
         throw new \Exception('To use the security by domain, you must define the security.domain_list parameter');
     }
     $roles = array();
     foreach ($config['security']['domain_list'] as $domain) {
         $roles[] = Security::getRoleForDomain($domain);
     }
     return $roles;
 }
 /**
  * Process security for the provided locale or domain. Either one of the both
  * parameters can be null if we don't need to check them.
  *
  * @param string $domain domain to check for
  * @param string $locale locale to check for
  *
  * @throws AccessDeniedHttpException
  */
 public function securityCheck($domain = null, $locale = null)
 {
     if (isset($domain) && $this->getSecurity()->isSecuredByDomain()) {
         if (!$this->getSecurityContext()->isGranted(Security::getRoleForDomain($domain))) {
             throw new AccessDeniedHttpException("You don't have permissions to work on translations for domain [{$domain}]");
         }
     }
     if (isset($locale) && $this->getSecurity()->isSecuredByLocale()) {
         if (!$this->getSecurityContext()->isGranted(Security::getRoleForLocale($locale))) {
             throw new AccessDeniedHttpException("You don't have permissions to work on translations for locale [{$locale}]");
         }
     }
 }