mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
fix bug when the form "add role" fails
This commit is contained in:
parent
0e5ab47474
commit
b038cdfdf5
@ -246,10 +246,13 @@ class PermissionsGroupController extends Controller
|
|||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
$permissionsGroup = $em->getRepository('ChillMainBundle:PermissionsGroup')->find($id);
|
$permissionsGroup = $em
|
||||||
|
->getRepository('ChillMainBundle:PermissionsGroup')
|
||||||
|
->find($id);
|
||||||
|
|
||||||
if (!$permissionsGroup) {
|
if (!$permissionsGroup) {
|
||||||
throw $this->createNotFoundException('Unable to find PermissionsGroup entity.');
|
throw $this->createNotFoundException('Unable to find Permissions'
|
||||||
|
. 'Group entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$editForm = $this->createEditForm($permissionsGroup);
|
$editForm = $this->createEditForm($permissionsGroup);
|
||||||
@ -270,8 +273,20 @@ class PermissionsGroupController extends Controller
|
|||||||
|
|
||||||
$addRoleScopesForm = $this->createAddRoleScopeForm($permissionsGroup);
|
$addRoleScopesForm = $this->createAddRoleScopeForm($permissionsGroup);
|
||||||
|
|
||||||
|
// sort role scope by title
|
||||||
|
/* @var $roleProvider \Chill\MainBundle\Security\RoleProvider */
|
||||||
|
$roleProvider = $this->get('chill.main.role_provider');
|
||||||
|
$roleScopesSorted = array();
|
||||||
|
foreach($permissionsGroup->getRoleScopes()->toArray() as $roleScope) {
|
||||||
|
/* @var $roleScope RoleScope */
|
||||||
|
$title = $roleProvider->getRoleTitle($roleScope->getRole());
|
||||||
|
$roleScopesSorted[$title][] = $roleScope;
|
||||||
|
}
|
||||||
|
ksort($roleScopesSorted);
|
||||||
|
|
||||||
return $this->render('ChillMainBundle:PermissionsGroup:edit.html.twig', array(
|
return $this->render('ChillMainBundle:PermissionsGroup:edit.html.twig', array(
|
||||||
'entity' => $permissionsGroup,
|
'entity' => $permissionsGroup,
|
||||||
|
'role_scopes_sorted' => $roleScopesSorted,
|
||||||
'edit_form' => $editForm->createView(),
|
'edit_form' => $editForm->createView(),
|
||||||
'expanded_roles' => $this->getExpandedRoles($permissionsGroup->getRoleScopes()->toArray()),
|
'expanded_roles' => $this->getExpandedRoles($permissionsGroup->getRoleScopes()->toArray()),
|
||||||
'delete_role_scopes_form' => array_map( function($form) {
|
'delete_role_scopes_form' => array_map( function($form) {
|
||||||
@ -419,9 +434,21 @@ class PermissionsGroupController extends Controller
|
|||||||
|
|
||||||
$addRoleScopesForm = $this->createAddRoleScopeForm($permissionsGroup);
|
$addRoleScopesForm = $this->createAddRoleScopeForm($permissionsGroup);
|
||||||
|
|
||||||
|
// sort role scope by title
|
||||||
|
/* @var $roleProvider \Chill\MainBundle\Security\RoleProvider */
|
||||||
|
$roleProvider = $this->get('chill.main.role_provider');
|
||||||
|
$roleScopesSorted = array();
|
||||||
|
foreach($permissionsGroup->getRoleScopes()->toArray() as $roleScope) {
|
||||||
|
/* @var $roleScope RoleScope */
|
||||||
|
$title = $roleProvider->getRoleTitle($roleScope->getRole());
|
||||||
|
$roleScopesSorted[$title][] = $roleScope;
|
||||||
|
}
|
||||||
|
ksort($roleScopesSorted);
|
||||||
|
|
||||||
return $this->render('ChillMainBundle:PermissionsGroup:edit.html.twig', array(
|
return $this->render('ChillMainBundle:PermissionsGroup:edit.html.twig', array(
|
||||||
'entity' => $permissionsGroup,
|
'entity' => $permissionsGroup,
|
||||||
'edit_form' => $editForm->createView(),
|
'edit_form' => $editForm->createView(),
|
||||||
|
'role_scopes_sorted' => $roleScopesSorted,
|
||||||
'expanded_roles' => $this->getExpandedRoles($permissionsGroup->getRoleScopes()->toArray()),
|
'expanded_roles' => $this->getExpandedRoles($permissionsGroup->getRoleScopes()->toArray()),
|
||||||
'delete_role_scopes_form' => array_map( function($form) {
|
'delete_role_scopes_form' => array_map( function($form) {
|
||||||
|
|
||||||
|
@ -4,3 +4,5 @@ The role "%role%" require to be associated with a scope.: Le rôle "%role%" doit
|
|||||||
The role "%role%" should not be associated with a scope.: Le rôle "%role%" ne doit pas être associé à un cercle.
|
The role "%role%" should not be associated with a scope.: Le rôle "%role%" ne doit pas être associé à un cercle.
|
||||||
"The password must contains one letter, one capitalized letter, one number and one special character as *[@#$%!,;:+\"'-/{}~=µ()£]). Other characters are allowed.": "Le mot de passe doit contenir une majuscule, une minuscule, et au moins un caractère spécial parmi *[@#$%!,;:+\"'-/{}~=µ()£]). Les autres caractères sont autorisés."
|
"The password must contains one letter, one capitalized letter, one number and one special character as *[@#$%!,;:+\"'-/{}~=µ()£]). Other characters are allowed.": "Le mot de passe doit contenir une majuscule, une minuscule, et au moins un caractère spécial parmi *[@#$%!,;:+\"'-/{}~=µ()£]). Les autres caractères sont autorisés."
|
||||||
The password fields must match: Les mots de passe doivent correspondre
|
The password fields must match: Les mots de passe doivent correspondre
|
||||||
|
|
||||||
|
A permission is already present for the same role and scope: Une permission est déjà présente pour le même rôle et cercle.
|
Loading…
x
Reference in New Issue
Block a user