apache / apache/grails-core

Make scaffolded actions tenant id aware

Open
#14,302 1 comment 0 reactions 0 assignees View on GitHub
relates-to: scaffolding
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

As GORM 6 has support for multi tenancy, scaffolded controllers for multi tenant domains should take into account the current tenant, which RestfulController (the super class for scaffolded controllers) don't.

ScaffoldingControllerInjector should detect that:
1) GORM 6 is being used
2) The scaffold property points to a domain class that implements MultiTenancy

If "1" and "2" are true, then the super class must be something that exposes the same actions as RestfulController but whose actions are tenant id aware, like:
` def delete() {
Tenants.withCurrent {
resource.withTransaction { transactionStatus ->
...
}
}
}`

If "1" or "2" are false then should behave as today

Contributor guide

Open the contributing guide

Research direction

Start with ScaffoldingControllerInjector and RestfulController, then inspect how scaffolded controllers choose their superclass and how GORM 6 MultiTenancy is detected. Compare the existing actions with the tenant-aware Tenants.withCurrent example; done means multi-tenant domains use an equivalent tenant-aware superclass while other domains behave as today.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.