Quick Start
Prerequisites
- Rust (edition 2021, stable recommended)
- A project to integrate kirino into
Add Dependency
Add kirino to your Cargo.toml:
toml
1
2
3
4
[dependencies]
kirino = "0.1"
tokio = { version = "1", features = ["full"] }
serde = { version = "1", features = ["derive"] }
Define Your Permissions
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use ;
use Permission;
Set Up the RBAC Engine
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use *;
async
Check Permissions
rust
1
2
3
4
5
6
7
8
9
10
11
12
async
Use the Built-in AuthService
For a complete setup with authentication, use AuthService:
rust
1
2
3
4
5
6
7
8
9
use ;
use Arc;
let engine = new;
let service = new;
// First user gets admin role automatically
service.register.await.unwrap;
let token = service.login.await.unwrap;
Verify
bash
1
2