https://github.com/casbin-rs/yaml-adapter
YAML Adapter for Casbin-RS
https://github.com/casbin-rs/yaml-adapter
abac acl adapter auth authorization authz casbin casbin-rs rbac rust storage yaml
Last synced: about 1 year ago
JSON representation
YAML Adapter for Casbin-RS
- Host: GitHub
- URL: https://github.com/casbin-rs/yaml-adapter
- Owner: casbin-rs
- License: apache-2.0
- Created: 2020-12-17T01:16:38.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-02-04T19:17:08.000Z (over 2 years ago)
- Last Synced: 2025-03-24T02:01:39.475Z (about 1 year ago)
- Topics: abac, acl, adapter, auth, authorization, authz, casbin, casbin-rs, rbac, rust, storage, yaml
- Language: Rust
- Homepage: https://github.com/casbin/casbin-rs
- Size: 20.5 KB
- Stars: 1
- Watchers: 5
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yaml-adapter
[](https://crates.io/crates/yaml-adapter)
[](https://docs.rs/yaml-adapter)

[](https://github.com/casbin-rs/yaml-adapter/actions/workflows/ci.yml)
Yaml Adapter is a [yaml](https://github.com/dtolnay/serde-yaml) adapter for [Casbin-rs](https://github.com/casbin/casbin-rs). With this library, Casbin can load policy from yaml fromat file or save policy into it with fully asynchronous support.
## Dependency
Add following to `Cargo.toml`
```
yaml-adapter = { version = "1.0.0", features = "runtime-async-std" }
async-std = "1.5.0"
```
for using `tokio`
```
yaml-adapter = { version = "1.0.0", features = "runtime-tokio" }
tokio = "0.3.1"
```
## Examples
```
let adapter = YamlAdapter::new("examples/rbac_policy.yaml");
let e = Enforcer::new(m, adapter).await.unwrap();
```
for policy file configuration, please refer to [example](../examples)