Add resource subscription authorization - #30
Conversation
| rescue | ||
| _ -> :error |
| try do | ||
| Phoenix.Tracker.get_by_key(__MODULE__, @resources, uri) | ||
| rescue | ||
| _ -> [] | ||
| end |
There was a problem hiding this comment.
verify compile without Phoenix.Tracker
|
@dbernheisel This looks like an approach that would work, but reviewing it raised an interesting question:
Should |
|
@merhard I don't figure it's Phantoms responsibility for the actual read, because it had to be implemented by the user, whereas the notifications are implemented by Phantom. But let me know if you see a gap. Are you thinking Phantom wouldn't even call the read callback if the user isn't authorized based on the notification subscription? |
|
@dbernheisel I was more just pointing out the inconsistency in case it was unintentional. If anything I would lean more towards none of the three (read, subscribe, notify) auto-referencing the allowed templates and having the user make that call in the hook (subscribe), callback (read), or before the function call (notify). But I think your argument that "it's Phantoms responsibility" because "the notifications are implemented by Phantom" is reasonable. |
|
I like escape hatches, so I'll see if I can add an optional override for notification authz if needed, but otherwise implemented by Phantom by default. |
Closes #29
Summary
authorize_resource_subscriptions/2callback for subscription requests and update deliveryPhantom.Tracker.notify_resources_updated/1, grouping subscribed resources per session for one authorization call per batch