public function getLocaleRoles($config)
 {
     $roles = array();
     foreach ($config['locale_list'] as $locale) {
         $roles[] = Security::getRoleForLocale($locale);
     }
     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}]");
         }
     }
 }
 protected function checkLocaleGrants($locale)
 {
     if (!$this->security->isGrantedForLocale($locale)) {
         throw new PermissionDeniedException("No rights to update locale [{$locale}]");
     }
 }