Closed ezekg closed 5 months ago
New plan: with the proof of concept union_of
gem, we're able to create associations that union across multiple associations. This allows us to really clean up our implementation here, and gets rid of the need to do a multi-part PR.
Let's clean up union_of
and add more exhaustive tests, and go in the direction mentioned in https://github.com/keygen-sh/keygen-api/issues/534#issuecomment-1858574833.
Should a machine belong to an owner? Right now, it doesn't make sense that a machine always belongs to the owner of the license, since in reality, it could belong to any of the license's licensees, not necessarily the license's owner.
Closes #534.
Prerequisites
user
validation scope to look atLicense#users
.owner
validation scope.License#user
toLicense#owner
.user
relationship toowner
in user serializer.users
relationship to license serializer.data.relationships.owner
todata.relationship.user
for licenses (with updated links).Renamelicense.user.updated
webhook event tolicense.owner.updated
? (Or send both?)Pre-deploy
license.owner.updated
,license.users.attached
,license.users.detached
,machine.owner.updated
event types.license.owner.update
,license.users.attach
,license.users.detach
,machine.owner.update
permissions.Post-deploy
licenses.user_id
tolicenses.owner_id
? (May want to do this during our next maintenance window.)Renamelicense.user.update
permission tolicense.owner.update
?license.owner.update
,license.users.attach
,license.users.detach
,machine.owner.update
permissions to relevant roles.