jdaugherty commented on PR #16515:
URL: https://github.com/apache/grails-core/pull/16515#issuecomment-6120103676
@matrei Thanks, you're right. 70743888e0 addresses the open point.
`Tenants.CurrentTenant.withoutTenant` now binds a marker in place of a
tenant id while the thread runs without a tenant. `get()` still reports it as
`DEFAULT`, so `currentId()`, the listener and the insert path are unchanged,
and `isWithoutId()` checks for the marker instead of comparing the bound tenant
id with `DEFAULT`. `withTenant` and `withoutTenant` save and restore the raw
binding, so the marker survives a nested `withId` inside `withoutId`.
`withId('DEFAULT')`, whether `withCurrent` or a `@CurrentTenant` method binds
it or it is called directly, now restricts lookups by id to the tenant
`DEFAULT`, as it does queries, and only `withoutId` lifts the restriction.
Both specs gain a feature that calls `findById`, `get`, `read`, `exists`,
`getAll` and `load` inside `Tenants.withCurrent` with the resolver returning
`DEFAULT`, and a `withTenant(DEFAULT)` case in the `withTenant` feature. The
`isWithoutId()` feature gains `withId(DEFAULT)`, `withTenant(DEFAULT)`,
`withCurrent` with the resolver returning `DEFAULT`, and the value after a
nested `withTenant` returns. At e8d235330a the new feature and the two extended
features fail in the simple spec, and the new feature and the extended
`withTenant` feature fail in the MongoDB spec. The upgrade note and the MongoDB
guide now say that only `withoutId` lifts the restriction, and the PR
description is updated.
Run locally at 70743888e0: `PartitionedLookupByIdSpec` (20) with the other
`grails.gorm.multitenancy` and `grails.gorm.services.multitenancy` specs and
`CurrentTenantTransformSpec` in `grails-datamapping-core-test` (27 in all),
`CurrentTenantTransformSpec` and `ServiceTransformSpec` in
`grails-datamapping-core` (35), the `multitenancy` specs and
`SchemaBasedMultiTenancySpec` in `grails-data-mongodb-core` (24), and
`codeStyle` for `grails-datamapping-core` and `grails-data-mongodb-core`; all
pass. CI runs the rest.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]