1 unstable release
0.0.1 | Jul 26, 2021 |
---|
#23 in #actix-web-middleware
22 downloads per month
Used in actix-loginmanager
6KB
60 lines
login_required macros for actix-loginmanager
Syntax
#[login_required(UserType,name="user")]
Attributes
UserType
- Define the variable type.name="user"
- Define the variable name.
Example
use actix_loginmanager::login_required;
// define or import `user` which implements `UserMinix` trait.
#[login_required(User)]
async fn hello()->impl actix_web::Responder{
user.is_actived(); //can access user:Rc<User>
return "hello";
}
#[login_required(User,name="user")]
async fn hello()->impl actix_web::Responder{
user.is_actived(); //can access user:Rc<User>
return "hello";
}
lib.rs
:
login_required macros for actix-loginmanager
Example
use actix_loginmanager::login_required;
// define or import `user` which implements `UserMinix` trait.
#[login_required(User)]
async fn hello()->impl actix_web::Responder{
user.is_actived(); //can access user:Rc<User>
return "hello";
}
#[login_required(User, name="user")]
async fn hello()->impl actix_web::Responder{
user.is_actived(); //can access user:Rc<User>
return "hello";
}
Dependencies
~1.5MB
~31K SLoC