An open API service indexing awesome lists of open source software.

https://github.com/php-casbin/etcd-adapter

ETCD Adapter for Casbin, Casbin is a powerful and efficient open-source access control library.
https://github.com/php-casbin/etcd-adapter

Last synced: 3 days ago
JSON representation

ETCD Adapter for Casbin, Casbin is a powerful and efficient open-source access control library.

Awesome Lists containing this project

README

          

# ETCD adapter for php-casbin

ETCD adapter for [PHP-Casbin](https://github.com/php-casbin/php-casbin).

### Usage

```php

require_once './vendor/autoload.php';

use Casbin\Enforcer;
use CasbinAdapter\Etcd\Adapter as EtcdAdapter;

$adapter = new EtcdAdapter($server, $version);

$e = new Enforcer('path/to/model.conf', $adapter);

$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.

if ($e->enforce($sub, $obj, $act) === true) {
// permit alice to read data1
} else {
// deny the request, show an error
}
```

### Getting Help

- [php-casbin](https://github.com/php-casbin/php-casbin)

### License

This project is licensed under the [Apache 2.0 license](LICENSE).