Attribute Macro actix_web_grants::proc_macro::has_any_role

source ·
#[has_any_role]
Expand description

Macro to сheck that the user has any the specified roles. Role - is permission with prefix “ROLE_”.

§Examples

use actix_web_grants::proc_macro::has_any_role;
use actix_web::HttpResponse;

// User should be ADMIN or MANAGER
#[has_any_role["ADMIN", "MANAGER"]]
async fn macro_secured() -> HttpResponse {
    HttpResponse::Ok().body("some secured info")
}