定制 fighting-pie/symfony-rbac 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fighting-pie/symfony-rbac

Composer 安装命令:

composer require fighting-pie/symfony-rbac

包简介

symfony bundle rbac

README 文档

README

Principle explanation:

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require fighting-pie/symfony-rbac "*"

or add

"fighting-pie/symfony-rbac": "*"

to the require section of your composer.json.

Usage

Once the extension is installed, simply modify your application configuration as follows:

Add Routing

#app/config/routes.yml

app_file:
    # loads routes from the given routing file stored in some bundle
    resource: '@SymfonyRbacBundle/Resources/config/routing/routes.yaml'

app_annotations:
    # loads routes from the PHP annotations of the controllers found in that directory
    resource: '@SymfonyRbacBundle/Controller/'
    type:     annotation

app_bundle:
    # loads routes from the YAML, XML or PHP files found in some bundle directory
    resource: '@SymfonyRbacBundle/Resources/config/routing/'
    type:     directory

Rbac Database's configuration (ex)

file of rbac-sql

#app/config/packages/doctrine.yaml

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
              .....
            rbac:
                driver: 'pdo_mysql'
                url: '%env(resolve:DATABASE_RBAC_URL)%'
        # IMPORTANT: You MUST configure your server version,
        # either here or in the DATABASE_URL env var (see .env file)
        #server_version: '5.7'
    orm:
        default_entity_manager: default
        entity_managers:
            default:
              .....
            rbac:
                connection: rbac
                mappings:
                    RbacBundle:
                        is_bundle: true
                        type: annotation
                        dir: 'Entity'
                        prefix: 'SymfonyBundle\SymfonyRbac\Entity'
                        alias: Rbac

Code

  
  use SymfonyRbac\Services\RbacManager;

  private $rbacManager;

  public function __construct(RbacManager $rbacManager) {
    $this->rbacManager = $rbacManager;
    $userId = 31;
    $permissionName = '/admin/user/31';
    $res =  $this->rbacManager->checkAccess($userId,$permissionName,[]);
  }

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-11-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固