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
34
35
36
37
38
39
//! Application-defined gates and policies over authenticated users.
//!
//! Applications register their own typed ability contexts while Aurelin owns
//! evaluation, denial responses, hooks, and Axum enforcement.
//!
//! ```
//! use aurelin_framework::authorization::Gate;
//!
//! #[derive(Clone)]
//! struct User { id: i64 }
//! #[derive(Clone)]
//! struct Article { owner_id: i64 }
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let mut gates = Gate::<User>::builder();
//! gates.define("update-article", |user: User, article: Article| async move {
//! user.id == article.owner_id
//! });
//! let gates = gates.build();
//! let user = User { id: 1 };
//! let article = Article { owner_id: 1 };
//!
//! gates
//! .for_user(Some(&user))
//! .authorize("update-article", &article)
//! .await?;
//! # Ok(())
//! # }
//! ```
pub use ;
pub use AuthorizeLayer;
pub use ;
pub use UserGate;