Git Product home page Git Product logo

userbundle's Introduction

AWHS Logo

UserBundle

UserBundle of AWHSPanel
This bundle provides basic authentication.

Requirements

Have installed the foundation

Installation

  1. Clone this bundle inside src/AWHS/ directory.
  2. Enable the bundle in the kernel by adding the following line right after //AWHS Bundles in app/AppKernel.php file:
    new AWHS\UserBundle\AWHSUserBundle(),
  3. Append the following configuration to the app/config.yml file:
#UserBundle Configuration
fos_user:
    db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
    firewall_name: main
    user_class: AWHS\UserBundle\Entity\User
    group:
        group_class: AWHS\UserBundle\Entity\Group
    profile:
        form:
            type: AWHS\UserBundle\Form\Type\ProfileFormType
    registration:
        form:
            type: AWHS\UserBundle\Form\Type\RegistrationFormType
  1. Append the following routing to the app/routing.yml file:
#FOSUserBundle
fos_user:
    resource: "@FOSUserBundle/Resources/config/routing/all.xml"
fos_user_group:
    resource: "@FOSUserBundle/Resources/config/routing/group.xml"
    prefix: /group
#UserBundle
awhs_user:
    resource: "@AWHSUserBundle/Resources/config/routing.yml"
    prefix:   /
  1. Configure the app/security.yml file as follow:
# To get started with security, check out the documentation:
# http://symfony.com/doc/current/book/security.html
security:

    encoders:
        FOS\UserBundle\Model\UserInterface: bcrypt
    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: ROLE_ADMIN
    # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
    providers:
        fos_userbundle:
            id: fos_user.user_provider.username

    firewalls:
        # disables authentication for assets and the profiler, adapt it according to your needs
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        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:
                # 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 }
  1. Update database & clear cache: php bin/console doctrine:schema:update --force; php bin/console cache:clear; php bin/console cache:clear --env=prod
    You may have to set permissions back to www-data chown -R www-data:www-data /usr/local/awhspanel/panel/*
  2. Create your first user: php bin/console fos:user:create yourUsername [email protected] yourPassword
  3. Give your user admin privilege : php bin/console fos:user:promote yourUsername ROLE_ADMIN

TODO

  • Multilingual
  • Refactoring old code.

userbundle's People

Contributors

thegrimmchester avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.