cakephp/acl 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

cakephp/acl

最新稳定版本:0.10.1

Composer 安装命令:

composer require cakephp/acl

包简介

Acl Plugin for CakePHP framework

关键字:

README 文档

README

Build Status Coverage Status License

ℹ️ The ACL Plugin is not actively maintained by the CakePHP core team. ℹ️ PR's to fix problems are welcome.

As a modern alternative please check out the Authentication and Authorization plugins.

A plugin for managing ACL in CakePHP applications.

Installing via composer

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require cakephp/acl

Then in your src/Application.php:

public function bootstrap()
{
    parent::bootstrap();
    $this->addPlugin('Acl');
}

Creating tables

To create the ACL requires tables, run the following Migrations command:

bin/cake migrations migrate -p Acl

Attaching the behavior

Add the Acl behavior to your table so it will automatically create an aco whenever a new record is saved:

public function initialize(array $config)
{
    parent::initialize($config);

    $this->addBehavior('Acl.Acl', ['controlled']);
}

Updating the entity

Before you can start using the behavior, you MUST add the parentNode() method to the corresponding Entity file or the AclBehavior will not be able to determine the parent->child relationships. Also make make sure the method returns either null or a parent Model reference.

public function parentNode() {
    return null;
}

If things went well you should now see an entry appearing in the acos database table whenever you save a new record.

Running tests

Assuming you have PHPUnit installed system wide using one of the methods stated here, you can run the tests for the Acl plugin by doing the following:

  1. Copy phpunit.xml.dist to phpunit.xml
  2. Add the relevant database credentials to your phpunit.xml if you want to run tests against a non-SQLite datasource.
  3. Run phpunit

统计信息

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

GitHub 信息

  • Stars: 108
  • Watchers: 37
  • Forks: 87
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-05-23