coosos / user-role-type-bundle
Generates a symfony form for user roles
Installs: 399
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.1
- symfony/config: ^3.4|^4.0|~5.0
- symfony/dependency-injection: ^3.4.26|^4.1.12|~5.0
- symfony/form: ^3.4|^4.0|~5.0
- symfony/http-kernel: ^3.4|^4.0|~5.0
- symfony/options-resolver: ^3.4|^4.0|~5.0
- symfony/security-bundle: ^3.4|^4.0|~5.0
- symfony/yaml: ^3.4|^4.0|~5.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-10-29 05:22:24 UTC
README
Requirements
Installation
Step 1 : Download the bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle :
composer require "coosos/user-role-type-bundle" "^2.0"
This command is used if composer is installed in your system.
Step 2: Enable the Bundle
Then, enable the bundle by adding the following line in the app/AppKernel.php
file of your project :
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Coosos\UserRoleTypeBundle\CoososUserRoleTypeBundle(),
);
// ...
}
// ...
}
Usage
Form type
use Coosos\UserRoleTypeBundle\Form\Type;
...
$builder->add("roles", UserRoleType::class, ["coosos_security_checked" => "strict"]);
Form twig
example
{{ form_start(userForm) }}
{{ form_row(userForm.roles.ROLE_ADMIN) }}
{{ form_end(userForm) }}
Option
- coosos_security_checked (default="strict")
- strict = Prevents from being able to attribute a higher grade than his own
- coosos_input_type (default="Symfony\Component\Form\Extension\Core\Type\CheckboxType")
- Allows you to select another type of input (interesting for customize)