A set of document models in our application has to fullfill certain invariants. Therefore I would like to forbid the use of those document models with the default A12 json rpc opertion like add document, modify document and delete document.
How can I do this?
I can’t use the usual data services events because this imposes a performance penalty and hides the invariants that must be followed in the event handling code. Instead in the application their are commands with clear distinct scope that work with these documents which makes it easy to apply the invariant checks that are necessary for the command.
hi,
Therefore I would like to forbid the use of those document models with the default A12 json rpc opertion like add document, modify document and delete document. →
By ‘forbid,’ do you mean we should prevent this only at the RPC request level, or should we also enforce it within the Service layer?
You could implement an additional authorization rule to block all actions for this specific document model globally.
I want to forbid it only on rpc layer. Service layer needs to work with these documents because that is the central business logic of the application.
Unfortunately, there is no out-of-the-box extension to reject add or update operations exclusively at the RPC layer. As a workaround, you could consider creating custom RPC for these actions and explicitly rejecting the specific document model.