Skip to content

Release 1.0.0

Compare
Choose a tag to compare
@amarjanica amarjanica released this 28 Mar 11:12
· 18 commits to main since this release

This release is a complete rework of permissions. Reason is need for async, no request extractor logic, and lifetime limitations.

Changed

  • Permission call signature. Instead of call(&req, &mut payload), it is now call(req, args).

  • Permission supports async functions and there's no need for data extractors. Works same as actix Handler. You can no write something like

async fn dummy_permission_check(
    _req: HttpRequest,
    dummy_service: web::Data<DummyService>,
    data: web::Query<MyStatus>,
) -> actix_web::Result<bool> {
    // Unecessary complicating permission check to show what it can do.
    // You have access to request, payload, and all injected dependencies through app_data.
    Ok(dummy_service.check(data.status.clone()))
}

Removed

  • Builder removed. No more composing different permissions. check method accepts a Permission instead of Builder, and would look like check(web::get(), dummy_permission_check, index))