caractère interdit dans nom de groupe (fixes #61)

This commit is contained in:
afornerot 2019-12-13 16:14:58 +01:00
parent 5e9d7765ce
commit cba255f52c
8 changed files with 35 additions and 3 deletions

View File

@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
(-100, 'DRAAF', '130007107');
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}aTs3IqgN93ehIEqy93uWTTyxg5wNa+80
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}W19NNpFWpdE/5tLu1a2+Fw2KWVZfpZpy
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');

View File

@ -1037,6 +1037,13 @@ class GroupController extends Controller
$tmp=$this->getEntityBy("CadolesCoreBundle:Niveau02","label",$data->getLabel());
if($tmp) $form->addError(new FormError('Un niveau de rang 02 utilise déjà ce label'));
// On s'assure que le label ne contient pas des caractères speciaux
$string = preg_replace('~[^@a-zA-Z0-9._-]~', '', $data->getLabel());
if($string!=$data->getLabel())
{
$form->addError(new FormError('Caractères interdit dans ce label'));
}
if($data->getFgcanshare()&&is_null($data->getPagetemplate()))
$form->addError(new FormError("Un groupe de travail doit avoir un modèle de page d'accueil"));
}

View File

@ -273,7 +273,7 @@ class Niveau01Controller extends Controller
if($data->getNiveau02s()->count() > 0) {
$form->addError(new FormError('Un niveau de rang 02 utilise ce niveau de rang 01 : suppression impossible'));
}
}
}
if ($form->get('submit')->isClicked() && ($mode=="submit" || $mode=="update")) {
@ -282,6 +282,13 @@ class Niveau01Controller extends Controller
$tmp=$this->getEntityBy("CadolesCoreBundle:Niveau02","label",$data->getLabel());
if($tmp) $form->addError(new FormError('Un niveau de rang 02 utilise déjà ce label'));
// On s'assure que le label ne contient pas des caractères speciaux
$string = preg_replace('~[^@a-zA-Z0-9._-]~', '', $data->getLabel());
if($string!=$data->getLabel())
{
$form->addError(new FormError('Caractères interdit dans ce label'));
}
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {

View File

@ -267,6 +267,13 @@ class Niveau02Controller extends Controller
$tmp=$this->getEntityBy("CadolesCoreBundle:Niveau01","label",$data->getLabel());
if($tmp) $form->addError(new FormError('Un niveau de rang 01 utilise déjà ce label'));
// On s'assure que le label ne contient pas des caractères speciaux
$string = preg_replace('~[^@a-zA-Z0-9._-]~', '', $data->getLabel());
if($string!=$data->getLabel())
{
$form->addError(new FormError('Caractères interdit dans ce label'));
}
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {

View File

@ -654,7 +654,7 @@ class UserController extends Controller
$fields=$this->getDefaultDatauser();
// Si un acces modo via console d'admin on s'assure qu'il a les droit dessus sinon retour à la liste
if($this->isGranted('ROLE_MODO')&&$access=="config") {
if($this->isGranted('ROLE_MODO')) {
$niveau01=$data->getNiveau01();
$modos=$this->get('security.token_storage')->getToken()->getUser()->getmodos();
$fgperm=false;

View File

@ -45,6 +45,9 @@
<div class="panel-body">
{% if form.label is defined %}
{{ form_row(form.label) }}
<div class='alert alert-info' style='font-size: 80%;padding: 5px;margin-top: -10px;'>
Caractères interdits = accent, espace, caractères spéciaux sauf @ . - _<br>
</div>
{% if form.fgassoc is defined %}
{% if masteridentity=="LDAP" %}

View File

@ -40,6 +40,10 @@
<div class="panel-body">
{{ form_row(form.label) }}
<div class='alert alert-info' style='font-size: 80%;padding: 5px;margin-top: -10px;'>
Caractères interdits = accent, espace, caractères spéciaux sauf @ . - _<br>
</div>
{{ form_row(form.siren) }}
{{ form_row(form.showsubappname) }}
{% if masteridentity=="LDAP" %}

View File

@ -41,6 +41,10 @@
<div class="panel-body">
{{ form_row(form.niveau01) }}
{{ form_row(form.label) }}
<div class='alert alert-info' style='font-size: 80%;padding: 5px;margin-top: -10px;'>
Caractères interdits = accent, espace, caractères spéciaux sauf @ . - _<br>
</div>
{{ form_row(form.siret) }}
{{ form_row(form.postaladress) }}
</div>