定制 ac/kalinka-bundle 二次开发

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

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

ac/kalinka-bundle

Composer 安装命令:

composer require ac/kalinka-bundle

包简介

Flexible authorization for your Symfony2 app

README 文档

README

Build Status

Symfony2 bundle for Kalinka.

Installation

  1. require "ac/kalinka-bundle": "~0.1.0" in your composer.json`
  2. run composer update ac/kalinka
  3. Instantiate AC\KalinkaBundle\ACKalinkaBundle in your AppKernel
  4. Configure the bundle, described below:

Configuration

ac_kalinka:
    #default_authorizer: 'default'
    authorizers:
        default:
            authenticated_role: 'authenticated'     #optional
            anonymous_role: 'anonymous'             #optional
            roles:                                  #map roles to actions and guard policies
                authenticated:
                    document:
                        read: 'allow'
                        index: 'allow'
                anonymous:
                    document:
                        read: 'allow'
                teacher:
                    system:
                        foo: 'allow'
                    document:
                        index: 'allow'
                        create: 'allow'
                        read: 'allow'
                        update: ['owner', 'unlocked']
                        delete: ['owner', 'unlocked']
                admin:
                    system:
                        foo: 'allow'
                        bar: 'allow'
                        baz: 'allow'
                    document:
                        index: 'allow'
                        create: 'allow'
                        read: 'allow'
                        update: 'allow'
                        delete: 'allow'
                student:
                    document:
                        index: 'allow'
                        read: 'allow'

Services

The bundle registers the kalinka.authorizer service, which you can use in your app:

$document = //...get some document instance, however you do that

$authorizer = $this->container->get('kalinka.authorizer');

if (!$authorizer->can('edit', 'document', $someDocument)) {
    throw new Exception('Computer says no. :(');
}

To register guards just use the kalinka.guard tag, and specify the domain of the guard. For example:

services:
    app.guard.document:
        class: ACME\AppBundle\Authorization\DocumentGuard
        tags:
            - { name: 'kalinka.guard', tag: 'document' }

You can also configure multiple authorizers if you need them.

#TODO: document said feature

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-07-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固