2017 © Pedro Peláez
 

symfony-bundle bvrolepermission

A Role Base Permission with fos userbundle

image

kapilpatel20/bvrolepermission

A Role Base Permission with fos userbundle

  • Tuesday, April 5, 2016
  • by kapilpatel20
  • Repository
  • 1 Watchers
  • 0 Stars
  • 163 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 13 % Grown

The README.md

bvrolepermission

Role Base permission with fos userbundle, (*1)

Installation Steps, (*2)

1) add "friendsofsymfony/user-bundle": "~2.0@dev" in your composer.json file under "require", (*3)

2) composer require kapilpatel20/bvrolepermission register bundle in AppKernel.php, (*4)

new FOS\UserBundle\FOSUserBundle(),
new BvRoleBundle\BvRoleBundle()

3) open yourproject/app/config/config.yml, put below code in this file, (*5)

fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
firewall_name: main
user_class: BvRoleBundle\Entity\User
firewall_name: main
group:
    group_class: BvRoleBundle\Entity\Group

4) open yourproject/app/config/routing.yml, put below code in this file, (*6)

bv_role:
resource: "@BvRoleBundle/Resources/config/routing.yml"
prefix:   /   

5) open yourproject/app/config/security.yml, update your code with following, (*7)

security:
encoders:
    FOS\UserBundle\Model\UserInterface: bcrypt

role_hierarchy:
    ROLE_ADMIN:       ROLE_USER
    ROLE_SUPER_ADMIN: ROLE_ADMIN

providers:
    fos_userbundle:
        id: fos_user.user_provider.username

firewalls:
    main:
        pattern: ^/
        form_login:
            provider: fos_userbundle
            #csrf_token_generator: security.csrf.token_manager
            # if you are using Symfony < 2.8, use the following config instead:
            success_handler: login_success_handler
            csrf_provider: form.csrf_provider

        logout:       true
        anonymous:    true

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 }

6) open yourproject/app/config/services.yml, update your code with following, (*8)

services:
fos_user.doctrine_registry:
    alias: doctrine 

7) generate tables, (*9)

php app/console doctrine:schema:update --dump-sql
php app/console doctrine:schema:update --force

That's it!!!!!! Now you can check effect of this bundle from your browser. open your browser and, (*10)

http://localhost/YOUR-PROJECT-NAME/web/app_dev.php/login, (*11)

The Versions

05/04 2016

dev-master

9999999-dev https://github.com/kapilpatel20/bvrolepermission

A Role Base Permission with fos userbundle

  Sources   Download

proprietary

The Requires

 

by Kapil

role base permission bundle