ardteam / user-project
User Bundle
Installs: 21
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.2
- doctrine/dbal: <2.5
- doctrine/doctrine-bundle: ~1.4
- doctrine/orm: ~2.2,>=2.2.3,<2.5
- friendsofsymfony/user-bundle: ~2.0@dev
- sonata-project/doctrine-extensions: ^1.0
- symfony/form: ~2.3
- symfony/framework-bundle: ~2.3
- symfony/security-bundle: ~2.3
- symfony/twig-bundle: ~2.3
Requires (Dev)
- doctrine/doctrine-bundle: ~1.3
- swiftmailer/swiftmailer: ~4.3|~5
- symfony/validator: ~2.3
- symfony/yaml: ~2.3
- willdurand/propel-typehintable-behavior: ~1.0
This package is not auto-updated.
Last update: 2024-12-21 19:26:37 UTC
README
Installation
Require the bundle in your composer.json file:
// composer.json
{
// ...
require:{
// ...
"ardteam/user-project" : "1.0.x@dev",
"friendsofsymfony/user-bundle": "@dev"
}
}
Register the bundle:
// app/AppKernel.php public function registerBundles() { return array( // ... new FOS\UserBundle\FOSUserBundle(), new AT\UserBundle\ATUserBundle(), // ... ); }
Install the bundle:
$ composer update
Configuration
# Add to app/config/config.yml doctrine: dbal: # ... types: json: Sonata\Doctrine\Types\JsonType fos_user: db_driver: orm firewall_name: main user_class: AT\UserBundle\Entity\User
# Add to app/config/security.yml security encoders: AT\UserBundle\Entity\User: sha512 role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] providers: fos_userbundle: id: fos_user.user_provider.username firewalls: # ... main: pattern: ^/ anonymous: true form_login: provider: fos_userbundle login_path: fos_user_security_login check_path: fos_user_security_check logout: path: fos_user_security_logout target: /admin/ # route après logout remember_me: key: %secret% # %secret% est un paramètre de parameters.yml access_control: # ... - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/admin/, role: ROLE_ADMIN } # exemple de route à sécuriser # ...
Import FOSUser routes
# Add to app/config/routing.yml # Sécurité & Connexion fos_user: resource: "@FOSUserBundle/Resources/config/routing/all.xml"
Usage
Create a user. For example :
$ php app/console fos:user:create <user_name> <user_email> <user_password> --super-admin