ns/simple-user-bundle

NSAdminBundle 的基础预配置用户管理和服务包

1.2.12 2021-02-15 20:23 UTC

This package is auto-updated.

Last update: 2024-09-16 04:42:06 UTC


README

NSAdminBundle 的基础预配置用户管理和服务包

##安装

需要 SimpleUserBundle composer require ns/simple-user-bundle

将其添加到项目 bundles.php 文件中 NS\SimpleUserBundle\NSSimpleUserBundle::class => ['all' => true],

并在项目的 routes.yaml 文件中引入路由配置。 注意:SimpleUserBundle 的路由必须包含在 AdminBundle 路由之前。

ns_simple_user:
    resource: "@NSSimpleUserBundle/Resources/config/routing.yml"
    prefix:  /

ns_admin:
    resource: "@NSAdminBundle/Resources/config/routing.yml"
    prefix:  /admin

更新项目 security.yaml 文件

security:
    encoders:
        NS\SimpleUserBundle\Security\SecurityUser:
            algorithm: bcrypt
        NS\SimpleUserBundle\Entity\User\User:
            algorithm: bcrypt
    providers:
        app:
            id: NS\SimpleUserBundle\Security\SecurityUserProvider
    firewalls:
        main:
            form_login:
                login_path: login
                check_path: login_check
            logout:
                path: logout
                target: login
    access_control:
        - { path: ^/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }

用户管理列表可以通过 admin_user_list 路由访问。