feat(intent): read-only mode for personal surfaces (personalReadOnly) - #6369
Merged
Conversation
A personal relation may declare personalReadOnly: true alongside personal: true - the generated <Entity>MyController then serves only the scoped reads and its create/update/delete return 405, and the my pages drop New/Edit/ Delete. For owner-owned reference records the person may SEE but never author (a leave-balance account, a payslip) - closes the self-grant hole where a writable personal surface let the owner create their own entitlement. The regular (power) controller is unaffected. Chain: RelationIntent.personalReadOnly -> EdmIntentGenerator emits relationshipPersonalReadOnly -> parameterUtils sets e.personalReadOnly (+ composition-child inheritance) -> EntityMyController.java.template guards the writes -> my-list-view/my-form-view drop the buttons. Guide + IT (IntentEmissionCoverageIT: Balance entity, emission asserts + runtime GET 200 / POST 405) extended per the engine-intent keyword contract. Addresses #6367.
…; 405 mapped to 400) + IT posts PascalCase body Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6367.
What
Adds a read-only mode to the personal (my) surface. A personal owner relation may now declare
personalReadOnly: truealongsidepersonal: true:<Entity>MyControllerserves the scoped reads (getAll / get / count) but its create/update/delete return 403 FORBIDDEN;sensitive:stripping and theapplication-personal-perspectivesregistration are unchanged;Why
A writable personal surface is wrong for records the owner may see but never author — a leave-balance/entitlement account (creating one on the my surface is a self-grant) or a payslip. Without this flag such surfaces are either unsafe or a hand-written controller + bespoke page.
Chain
RelationIntent.personalReadOnly→EdmIntentGeneratoremitsrelationshipPersonalReadOnly→parameterUtils.jssetse.personalReadOnly(+ composition-child inheritance) →EntityMyController.java.templateguards the write methods →my-list-view/my-form-viewdrop the buttons.Test
IntentEmissionCoverageITgains aBalanceentity (owned byPerson,personalReadOnly: true) with:HttpStatus.FORBIDDEN, does not emitrepository.save, and the my list view has no New button;GET /balance/BalanceMyController→ 200,POST→ 403.Green locally (
Tests run: 1, Failures: 0).Note
403 FORBIDDEN (not 405) is used for the write refusal: the rs SDK's
ControllerInvokerhonors a handler-thrownResponseStatusExceptionstatus, and 403 is already the surface's convention (the "no identity mapped" case). A handler-thrown 405 was observed to surface as 400.