Search code examples
fiwarefiware-orion

How to get from Orion all subscriptions inserted by owners


I need to filter subscriptions through logged users (i.e. user_id or organization_id) in a generic context. The requirements are that any users can manage (edit or delete) only own subscriptions. As far as I know, there isn't APIs to filter subscriptions by userid, so how can get from orion all subscriptions inserted by owners?


Solution

  • Orion doesn't support the ownership concept in subscriptions. A possible workaround could be to use some descriptive field (in particular, the description field) and a PEP-like proxy using that information to implement a mechanism like the one you want.

    • At subscription creation time the proxy set the description to the user issuing the creation request.
    • At subscription modification time, the proxy check if the user issuing the update request matches the one in the description.
    • The proxy should forbid any attempt of setting/modifying the description field.

    Not perfect, but may suffice your case. A proxy like that shouldn't be complex to implement in technologies like Nodejs.