Allow editing a non owner record

Hello, I'm in the process of developing an order management system where a buyer places a purchase order with a seller in a different tenant. So far, everything is functioning smoothly (I'm using a single table). However, a challenge arises when the seller in another tenant attempts to access the record, resulting in a 404 error. I've identified that this issue stems from the fact that the seller is not the owner of the record, as I modify the team_id in the database, allowing me to view it without any problems. I'm unsure about how to configure the system to display the field and permit editing, even if the user is not the owner. Do you have any suggestions? I've read about record ownership in the documentation, but I'm uncertain about its practical implementation. It's worth noting that the table includes two foreign keys (team_id and provider_id, the latter being the team ID of the seller).
5 Replies
ingmontoya
ingmontoyaOP10mo ago
Up anyone?
Tieme
Tieme10mo ago
Personaly, dont use a single table for a order that multiple tenants can change.
ingmontoya
ingmontoyaOP10mo ago
but, using an intermediate table, I'm going to face same issue, the owner will always be the tenant that creates the purchase order, but the provider will not be able to view that record... does that makes sense? up
Tim van Heugten
Tim van Heugten10mo ago
Can a seller also be a buyer? Is being a seller or buyer a property of the tenant? Not knowing your architecture makes this difficult to answer, but you could have different panels (buyer vs seller) and for the order resource set up different tenancy for each panel (team_id vs provider_id). Or have two resources (sales orders vs purchase orders) using the same model but with different tenancy behavior.
ingmontoya
ingmontoyaOP10mo ago
Thanks Tim. And yes, a seller can also be a buyer, and also, seller or buyer is a property within a tenant. I guess my confusion is related to the buyer as he is the one that creates the order, then the seller who sees that order, can't edit or view it bc it show an 404 even though it appears in the table...
Want results from more Discord servers?
Add your server