Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/build.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build
name: test

on:
push:
Expand All @@ -15,22 +15,22 @@ jobs:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: cake_adapter
MYSQL_DATABASE: cake-permission
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

strategy:
fail-fast: true
matrix:
php: [ 7.3, 7.4 ]
stability: [ prefer-lowest, prefer-stable ]
php: [7.3, 7.4, 8.0, 8.1, 8.2]
stability: [prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.stability }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -73,10 +73,10 @@ jobs:
runs-on: ubuntu-latest
needs: [ test, upload-coverage ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14.17'
node-version: 'lts/*'

- name: Run semantic-release
env:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ composer.lock
*.iml

# coverage report
/build
/build

.phpunit.result.cache
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Cake-Casbin
# Cake-Permission

[![Latest Stable Version](https://poser.pugx.org/casbin/cake-adapter/v/stable)](https://packagist.org/packages/casbin/cake-adapter)
[![Total Downloads](https://poser.pugx.org/casbin/cake-adapter/downloads)](https://packagist.org/packages/casbin/cake-adapter)
[![License](https://poser.pugx.org/casbin/cake-adapter/license)](https://packagist.org/packages/casbin/cake-adapter)
[![Test](https://github.com/php-casbin/cake-permission/workflows/build/badge.svg?branch=master)](https://github.com/php-casbin/cake-permission/actions)
[![Coverage Status](https://coveralls.io/repos/github/php-casbin/cake-permission/badge.svg)](https://coveralls.io/github/php-casbin/cake-permission)
[![Latest Stable Version](https://poser.pugx.org/casbin/cake-adapter/v/stable)](https://packagist.org/packages/casbin/cake-permission)
[![Total Downloads](https://poser.pugx.org/casbin/cake-adapter/downloads)](https://packagist.org/packages/casbin/cake-permission)
[![License](https://poser.pugx.org/casbin/cake-adapter/license)](https://packagist.org/packages/casbin/cake-permission)

Use Casbin in CakePHP Framework, Casbin is a powerful and efficient open-source access control library.

Expand All @@ -11,7 +13,7 @@ Use Casbin in CakePHP Framework, Casbin is a powerful and efficient open-source
Require this package in the `composer.json` of your CakePHP project. This will download the package.

```
composer require casbin/cake-adapter
composer require casbin/cake-permission
```

create config file `config/casbin.php` for Casbin:
Expand All @@ -32,7 +34,7 @@ return [
],

// Cake-casbin adapter .
'adapter' => '\CasbinAdapter\Cake\Adapter',
'adapter' => '\Cake\Permission\Adapter',

/*
* Cake-casbin database setting.
Expand Down Expand Up @@ -72,7 +74,7 @@ $sub = 'alice'; // the user that wants to access a resource.
$obj = 'data1'; // the resource that is going to be accessed.
$act = 'read'; // the operation that the user performs on the resource.

$casbin = new \CasbinAdapter\Cake\Casbin();
$casbin = new \Cake\Permission\Casbin();

if (true === $casbin->enforce($sub, $obj, $act)) {
// permit alice to read data1
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
"description": "Use casbin in CakePHP. ",
"authors": [
{
"name": "TechLee",
"email": "techlee@qq.com"
"name": "JonLee",
"email": "leeqvip@gmail.com"
}
],
"license": "Apache-2.0",
"require": {
"php": ">=7.2.0",
"cakephp/cakephp": "~4.0",
"cakephp/cakephp": "~4.0|~5.0",
"casbin/casbin": "~3.1"
},
"require-dev": {
"phpunit/phpunit": "~8.5.0 || ^9.3"
},
"autoload": {
"psr-4": {
"CasbinAdapter\\Cake\\": "src/"
"Cake\\Permission\\": "src/"
}
}
}
Loading