Skip to content

Commit 102b165

Browse files
authored
Merge pull request #14 from php-casbin/develop
BREAKING CHANGE: change namespace to Cake\Permission and support cakephp 5.0
2 parents 92a84f3 + c45419a commit 102b165

File tree

12 files changed

+39
-4177
lines changed

12 files changed

+39
-4177
lines changed

.github/workflows/build.yml renamed to .github/workflows/test.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: build
1+
name: test
22

33
on:
44
push:
@@ -15,22 +15,22 @@ jobs:
1515
image: mysql:5.7
1616
env:
1717
MYSQL_ALLOW_EMPTY_PASSWORD: yes
18-
MYSQL_DATABASE: cake_adapter
18+
MYSQL_DATABASE: cake-permission
1919
ports:
2020
- 3306:3306
2121
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
2222

2323
strategy:
2424
fail-fast: true
2525
matrix:
26-
php: [ 7.3, 7.4 ]
27-
stability: [ prefer-lowest, prefer-stable ]
26+
php: [7.3, 7.4, 8.0, 8.1, 8.2]
27+
stability: [prefer-stable]
2828

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

3131
steps:
3232
- name: Checkout code
33-
uses: actions/checkout@v2
33+
uses: actions/checkout@v3
3434

3535
- name: Setup PHP
3636
uses: shivammathur/setup-php@v2
@@ -73,10 +73,10 @@ jobs:
7373
runs-on: ubuntu-latest
7474
needs: [ test, upload-coverage ]
7575
steps:
76-
- uses: actions/checkout@v2
77-
- uses: actions/setup-node@v1
76+
- uses: actions/checkout@v3
77+
- uses: actions/setup-node@v3
7878
with:
79-
node-version: '14.17'
79+
node-version: 'lts/*'
8080

8181
- name: Run semantic-release
8282
env:

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ composer.lock
77
*.iml
88

99
# coverage report
10-
/build
10+
/build
11+
12+
.phpunit.result.cache

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# Cake-Casbin
1+
# Cake-Permission
22

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

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

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

1315
```
14-
composer require casbin/cake-adapter
16+
composer require casbin/cake-permission
1517
```
1618

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

3436
// Cake-casbin adapter .
35-
'adapter' => '\CasbinAdapter\Cake\Adapter',
37+
'adapter' => '\Cake\Permission\Adapter',
3638

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

75-
$casbin = new \CasbinAdapter\Cake\Casbin();
77+
$casbin = new \Cake\Permission\Casbin();
7678

7779
if (true === $casbin->enforce($sub, $obj, $act)) {
7880
// permit alice to read data1

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
"description": "Use casbin in CakePHP. ",
55
"authors": [
66
{
7-
"name": "TechLee",
8-
"email": "techlee@qq.com"
7+
"name": "JonLee",
8+
"email": "leeqvip@gmail.com"
99
}
1010
],
1111
"license": "Apache-2.0",
1212
"require": {
1313
"php": ">=7.2.0",
14-
"cakephp/cakephp": "~4.0",
14+
"cakephp/cakephp": "~4.0|~5.0",
1515
"casbin/casbin": "~3.1"
1616
},
1717
"require-dev": {
1818
"phpunit/phpunit": "~8.5.0 || ^9.3"
1919
},
2020
"autoload": {
2121
"psr-4": {
22-
"CasbinAdapter\\Cake\\": "src/"
22+
"Cake\\Permission\\": "src/"
2323
}
2424
}
2525
}

0 commit comments

Comments
 (0)