Attribute Macro actix_web_grants::proc_macro::has_roles

source ·
#[has_roles]
Expand description

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

Examples

use actix_web_grants::proc_macro::has_roles;
use actix_web::HttpResponse;

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