Permalink
Browse files

add FOSUserBunble

  • Loading branch information...
1 parent 8f97abf commit e13cf4653402d2e4066c21977989a02f1acc0d2b Florian Pondepeyre committed Mar 8, 2013
Showing with 700 additions and 171 deletions.
  1. +1 −0 app/AppKernel.php
  2. +6 −1 app/config/config.yml
  3. +19 −0 app/config/routing.yml
  4. +14 −26 app/config/security.yml
  5. +58 −0 app/propel/sql/default.sql
  6. +3 −1 composer.json
  7. +599 −143 composer.lock
View
@@ -22,6 +22,7 @@ public function registerBundles()
new Propel\PropelBundle\PropelBundle(),
new Gr\BackendBundle\GrBackendBundle(),
new Gr\ModelBundle\GrModelBundle(),
+ new FOS\UserBundle\FOSUserBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
View
@@ -4,7 +4,7 @@ imports:
framework:
#esi: ~
- #translator: { fallback: %locale% }
+ translator: { fallback: %locale% }
secret: %secret%
router:
resource: "%kernel.root_dir%/config/routing.yml"
@@ -72,3 +72,8 @@ propel:
dsn: %database_driver%:host=%database_host%;dbname=%database_name%;charset=UTF8
options: {}
attributes: {}
+
+fos_user:
+ db_driver: propel # other valid values are 'mongodb', 'couchdb' and 'propel'
+ firewall_name: main
+ user_class: FOS\UserBundle\Propel\User
View
@@ -5,3 +5,22 @@ gr_model:
gr_backend:
resource: "@GrBackendBundle/Resources/config/routing.yml"
prefix: /
+
+fos_user_security:
+ resource: "@FOSUserBundle/Resources/config/routing/security.xml"
+
+fos_user_profile:
+ resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
+ prefix: /profile
+
+fos_user_register:
+ resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
+ prefix: /register
+
+fos_user_resetting:
+ resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
+ prefix: /resetting
+
+fos_user_change_password:
+ resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
+ prefix: /profile
View
@@ -4,39 +4,27 @@ jms_security_extra:
security:
encoders:
- Symfony\Component\Security\Core\User\User: plaintext
+ FOS\UserBundle\Model\UserInterface: sha512
role_hierarchy:
ROLE_ADMIN: ROLE_USER
- ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
+ ROLE_SUPER_ADMIN: ROLE_ADMIN
providers:
- in_memory:
- memory:
- users:
- user: { password: userpass, roles: [ 'ROLE_USER' ] }
- admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
+ fos_userbundle:
+ id: fos_user.user_provider.username
firewalls:
- dev:
- pattern: ^/(_(profiler|wdt)|css|images|js)/
- security: false
-
- login:
- pattern: ^/demo/secured/login$
- security: false
-
- secured_area:
- pattern: ^/demo/secured/
+ main:
+ pattern: ^/
form_login:
- check_path: _security_check
- login_path: _demo_login
- logout:
- path: _demo_logout
- target: _demo
- #anonymous: ~
- #http_basic:
- # realm: "Secured Demo Area"
+ provider: fos_userbundle
+ csrf_provider: form.csrf_provider
+ logout: true
+ anonymous: true
access_control:
- #- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
+ - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
+ - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
+ - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
+ - { path: ^/admin/, role: ROLE_ADMIN }
View
@@ -4,6 +4,64 @@
SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------------------------------------------------
+-- fos_user
+-- ---------------------------------------------------------------------
+
+DROP TABLE IF EXISTS `fos_user`;
+
+CREATE TABLE `fos_user`
+(
+ `id` INTEGER NOT NULL AUTO_INCREMENT,
+ `username` VARCHAR(255),
+ `username_canonical` VARCHAR(255),
+ `email` VARCHAR(255),
+ `email_canonical` VARCHAR(255),
+ `enabled` TINYINT(1) DEFAULT 0,
+ `salt` VARCHAR(255) NOT NULL,
+ `password` VARCHAR(255) NOT NULL,
+ `last_login` DATETIME,
+ `locked` TINYINT(1) DEFAULT 0,
+ `expired` TINYINT(1) DEFAULT 0,
+ `expires_at` DATETIME,
+ `confirmation_token` VARCHAR(255),
+ `password_requested_at` DATETIME,
+ `credentials_expired` TINYINT(1) DEFAULT 0,
+ `credentials_expire_at` DATETIME,
+ `roles` TEXT,
+ PRIMARY KEY (`id`),
+ UNIQUE INDEX `fos_user_U_1` (`username_canonical`),
+ UNIQUE INDEX `fos_user_U_2` (`email_canonical`)
+) ENGINE=MyISAM;
+
+-- ---------------------------------------------------------------------
+-- fos_group
+-- ---------------------------------------------------------------------
+
+DROP TABLE IF EXISTS `fos_group`;
+
+CREATE TABLE `fos_group`
+(
+ `id` INTEGER NOT NULL AUTO_INCREMENT,
+ `name` VARCHAR(255) NOT NULL,
+ `roles` TEXT,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM;
+
+-- ---------------------------------------------------------------------
+-- fos_user_group
+-- ---------------------------------------------------------------------
+
+DROP TABLE IF EXISTS `fos_user_group`;
+
+CREATE TABLE `fos_user_group`
+(
+ `fos_user_id` INTEGER NOT NULL,
+ `fos_group_id` INTEGER NOT NULL,
+ PRIMARY KEY (`fos_user_id`,`fos_group_id`),
+ INDEX `fos_user_group_FI_2` (`fos_group_id`)
+) ENGINE=MyISAM;
+
+-- ---------------------------------------------------------------------
-- news
-- ---------------------------------------------------------------------
View
@@ -18,7 +18,9 @@
"sensio/generator-bundle": "2.2.*",
"jms/security-extra-bundle": "1.4.*",
"jms/di-extra-bundle": "1.3.*",
- "propel/propel-bundle": "1.2.*@dev"
+ "propel/propel-bundle": "1.2.*@dev",
+ "friendsofsymfony/user-bundle": "*",
+ "willdurand/propel-typehintable-behavior": "*"
},
"scripts": {
"post-install-cmd": [
Oops, something went wrong.

0 comments on commit e13cf46

Please sign in to comment.