Rustango docs

Actions & permissions

Bulk actions and per-model permission gating.

Register bulk actions that receive the selected primary keys; the admin renders a button and runs your closure in a transaction. Every model gets four permission codenames (add/change/delete/view) seeded on first migrate; the admin gates UI and actions on them.

register_admin_action!(Article, "publish", "Publish selected", |pool, ids| async move {
    Article::objects().filter(Article::id.is_in(ids))
        .update_pool(&pool, &[("status", "published")]).await?;
    Ok(())
});