pub struct TenantSeeder(pub for<'a> fn(&'a Pool, &'a Org) -> SeedFuture<'a>);Expand description
A host-registered per-tenant seeding pass.
Everything above in this loop — page types, library types, roles,
locales, MCP skills — is seeded per tenant with the tenant’s pool.
A host application had no way into that: Cli::seed hands it the
registry pool, so a host wanting its own permission codename on a
role, or a default row in its own table, either wrote to the wrong
database or did without.
This is that hook. It runs once per active tenant per boot, with the tenant’s pool, after the CMS’s own seeding.
fn seed<'a>(pool: &'a Pool, _org: &'a Org) -> SeedFuture<'a> {
Box::pin(async move {
rustango_cms::seed::grant_codename(pool, "Developer", "myapp.author").await?;
Ok(())
})
}
rustango_cms::register_tenant_seeder!(seed);Errors stop the boot. That is deliberate: a seeder returning
Err is saying this tenant is not correctly set up, and the failure
this hook exists to prevent — a permission that silently reaches
nobody — is exactly the kind that nothing downstream detects. A host
that wants best-effort behaviour should log and return Ok(())
itself, where it knows what is safe to skip.
Tuple Fields§
§0: for<'a> fn(&'a Pool, &'a Org) -> SeedFuture<'a>Trait Implementations§
Source§impl Clone for TenantSeeder
impl Clone for TenantSeeder
impl Collect for TenantSeeder
impl Copy for TenantSeeder
Auto Trait Implementations§
impl Forget for TenantSeeder
impl Freeze for TenantSeeder
impl RefUnwindSafe for TenantSeeder
impl Send for TenantSeeder
impl Sync for TenantSeeder
impl Unpin for TenantSeeder
impl UnsafeUnpin for TenantSeeder
impl UnwindSafe for TenantSeeder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more