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.
- Host: GitHub
- URL: https://github.com/php-casbin/etcd-adapter
- Owner: php-casbin
- License: apache-2.0
- Created: 2022-07-06T13:42:07.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-08-16T16:38:54.000Z (over 3 years ago)
- Last Synced: 2025-12-30T08:57:04.135Z (4 months ago)
- Language: PHP
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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).