Skip to content

Commit f8d4b40

Browse files
committed
Added some badges
1 parent db479da commit f8d4b40

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# Database adapter for php-casbin
22

3-
Database adapter for php-casbin.
3+
[![Latest Stable Version](https://poser.pugx.org/casbin/database-adapter/v/stable)](https://packagist.org/packages/casbin/database-adapter)
4+
[![Total Downloads](https://poser.pugx.org/casbin/database-adapter/downloads)](https://packagist.org/packages/casbin/database-adapter)
5+
[![License](https://poser.pugx.org/casbin/database-adapter/license)](https://packagist.org/packages/casbin/database-adapter)
46

5-
the current supported databases are:
7+
Database adapter for [PHP-Casbin](https://github.com/php-casbin/php-casbin).
8+
9+
The current supported databases are:
610

711
| type | database |
812
| ------ | ------ |
@@ -29,8 +33,6 @@ use Casbin\Enforcer;
2933
use Casbin\Util\Log;
3034
use CasbinAdapter\Database\Adapter as DatabaseAdapter;
3135

32-
Log::$enableLog = true;
33-
3436
$config = [
3537
'type' => 'mysql', // mysql,pgsql,sqlite,sqlsrv
3638
'hostname' => '127.0.0.1',
@@ -42,14 +44,14 @@ $config = [
4244

4345
$adapter = DatabaseAdapter::newAdapter($config);
4446

45-
$e = new Enforcer(__DIR__ . '/examples/modelandpolicy/basic_model.conf', $adapter);
47+
$e = new Enforcer('path/to/model.conf', $adapter);
4648

4749
$sub = "alice"; // the user that wants to access a resource.
4850
$obj = "data1"; // the resource that is going to be accessed.
4951
$act = "read"; // the operation that the user performs on the resource.
5052

5153
if ($e->enforce($sub, $obj, $act) === true) {
52-
// permit alice to read data1x
54+
// permit alice to read data1
5355
} else {
5456
// deny the request, show an error
5557
}

0 commit comments

Comments
 (0)