Skip to content

Commit e83e5b6

Browse files
committed
Fixed bugs in Adapter and updated composer.json.
1 parent e73cb8c commit e83e5b6

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

composer.json

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
{
22
"name": "casbin/think-authz",
3-
"keywords": ["thinkphp", "casbin", "permission", "access-control", "authorization", "rbac", "acl", "abac", "authz"],
3+
"keywords": [
4+
"thinkphp",
5+
"casbin",
6+
"permission",
7+
"access-control",
8+
"authorization",
9+
"rbac",
10+
"acl",
11+
"abac",
12+
"authz"
13+
],
414
"description": "An authorization library that supports access control models like ACL, RBAC, ABAC in ThinkPHP 6. ",
515
"authors": [
616
{
@@ -10,15 +20,16 @@
1020
],
1121
"license": "Apache-2.0",
1222
"require": {
13-
"casbin/casbin": ">=0.2.1",
14-
"topthink/framework": "6.0.x-dev",
23+
"casbin/casbin": "~1.0",
24+
"topthink/framework": "6.0.*-dev",
25+
"topthink/think-orm": "2.0.*-dev",
1526
"topthink/think-migration": "^3.0"
1627
},
1728
"require-dev": {
1829
"phpunit/phpunit": "~7.0",
1930
"php-coveralls/php-coveralls": "^2.1",
2031
"mockery/mockery": "^1.0",
21-
"topthink/think": "6.0.x-dev"
32+
"topthink/think": "6.0.*-dev"
2233
},
2334
"autoload": {
2435
"psr-4": {
@@ -27,7 +38,7 @@
2738
},
2839
"autoload-dev": {
2940
"psr-4": {
30-
"tauthz\\tests\\": "tests/"
41+
"tauthz\\tests\\": "tests/"
3142
}
3243
},
3344
"config": {
@@ -40,4 +51,4 @@
4051
]
4152
}
4253
}
43-
}
54+
}

src/adapter/DatabaseAdapter.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ public function loadPolicy($model)
6060
{
6161
$rows = $this->model->select()->toArray();
6262
foreach ($rows as $row) {
63-
$line = implode(', ', array_slice(array_values($row), 1));
63+
$line = implode(', ', array_filter(array_slice($row, 1),function($val){
64+
return $val != "" && !is_null($val);
65+
}));
6466
$this->loadPolicyLine(trim($line), $model);
6567
}
6668
}

0 commit comments

Comments
 (0)