定制 artox-lab/clarc-bundle 二次开发

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

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

artox-lab/clarc-bundle

Composer 安装命令:

composer require artox-lab/clarc-bundle

包简介

Build Symfony project within Clean Architecture

README 文档

README

Applications that use Symfony Flex

Open a command console, enter your project directory and execute:

$ composer require artox-lab/clarc-bundle

Applications that don't use Symfony Flex

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require artox-lab/clarc-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:

// config/bundles.php

return [
    // ...
    ArtoxLab\Bundle\ClarcBundle\ArtoxLabClarcBundle::class => ['all' => true],
];

Step 3: Configuration

Configure bundle

# config/packages/artox_lab_clarc.yaml

artox_lab_clarc:
    api:
        serializer:
            class: \ArtoxLab\Bundle\ClarcBundle\Core\Interfaces\UI\API\Transformers\Serializers\NullObjectArraySerializer
    security:
        rbac:
            permissions:
                ROLE_MAINTAINER:
                    - show

Security

How to setup get authenticated user permissions API endpoint

  1. Add to your project routes file config/routes.yaml
artox_lab_clarc_bundle_user_permissions:
    path: /v1/user/permissions
    controller: ArtoxLab\Bundle\ClarcBundle\Core\Interfaces\UI\API\Controllers\PermissionController::permissions
    methods: GET
  1. Setup firewall and access control in config/packages/security.yaml
security:
    firewalls:
      users:
          pattern: ^/v1
          ...
    access_control:
        - { path: ^/v1/, roles: IS_AUTHENTICATED_FULLY }

Note: If you have more than one authenticator - do the setup for each one

How to use RBAC

  1. Setup roles and permissions in config config/packages/artox_lab_clarc.yaml
  2. Require ArtoxLab\Bundle\ClarcBundle\Core\Entity\Security\AuthorizationChecker in your use case / controller
  3. Check user permission $this->authorizationChecker->isGranted('permission_name')

Navigation

  1. Setup config
# config/packages/artox_lab_clarc.yaml

artox_lab_clarc:
    navigation:
        left_menu:
            show_orphaned_root: false
            items:
                -   icon: portfolio
                    title: Управление компаниями
                    children:
                        -   icon: something
                            link: /companies
                            title: Компании
                            permissions: company.list
                        -   link: /companies/add
                            title: Добавить компанию
                            permissions: [company.create]
  1. Add routes
# config/routes.yaml

artox_lab_admin_user_navigations:
    path: /user/navigations
    controller: ArtoxLab\Bundle\ClarcBundle\Core\Interfaces\UI\API\Controllers\NavigationController::userNavigation
    methods: GET
  1. Secure routes
# config/packages/security.yaml

security:
    firewalls:
        main:
            pattern: ^/user
            ...
    access_control:
        - { path: ^/user, roles: IS_AUTHENTICATED_FULLY}
  1. Call API GET /user/navigations with authentication

Learn more

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-09-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固