Make a hierarchy in roles

This is more understandable for users.
This commit is contained in:
2017-04-19 21:24:35 +02:00
parent b6d1f05e00
commit 0e5ab47474
7 changed files with 190 additions and 33 deletions

View File

@@ -56,12 +56,20 @@ class ComposedRoleScopeType extends AbstractType
*/
private $translatableStringHelper;
public function __construct(TranslatableStringHelper $translatableStringHelper,
RoleProvider $roleProvider)
{
/**
*
* @var RoleProvider
*/
private $roleProvider;
public function __construct(
TranslatableStringHelper $translatableStringHelper,
RoleProvider $roleProvider
) {
$this->roles = $roleProvider->getRoles();
$this->rolesWithoutScope = $roleProvider->getRolesWithoutScopes();
$this->translatableStringHelper = $translatableStringHelper;
$this->roleProvider = $roleProvider;
}
public function buildForm(FormBuilderInterface $builder, array $options)
@@ -86,6 +94,9 @@ class ComposedRoleScopeType extends AbstractType
} else {
return array('data-has-scope' => '1');
}
},
'group_by' => function($role, $key, $index) {
return $this->roleProvider->getRoleTitle($role);
}
))
->add('scope', 'entity', array(