nearform / udaru

Open source Access Manager for node.js
https://nearform.github.io/udaru
MIT License
124 stars 19 forks source link

Policy Instance Updates #516

Closed cianfoley-nearform closed 6 years ago

cianfoley-nearform commented 6 years ago

We solved the issue with deletion of policy instances using an autoincrementing instance ID

Currently a delete and replace will increment the instance ID so we need to update the API to facilitate updating an policy with the instance id,

suggest that the entity/{id}/policies PUT payload performs an UPDATE if an optional instance id is present in the policy payload and INSERTS new one otherwise.

POST will probably eventually be removed as it performs a replace on all policies (DELETE/INSERT) and so the instance id should never be present in this payload

Otherwise we could allow update a single entity creating another endpoint, but i prefer first option e.g. entity/{id}/policies/{id}?instance=x

cianfoley-nearform commented 6 years ago

PR in for this here: https://github.com/nearform/udaru/pull/520