-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
access-control: added new playbackPolicy & webhook trigger #1665
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov Report
@@ Coverage Diff @@
## master #1665 +/- ##
===================================================
- Coverage 53.49990% 53.00491% -0.49499%
===================================================
Files 74 74
Lines 4843 4892 +49
Branches 939 952 +13
===================================================
+ Hits 2591 2593 +2
- Misses 1923 1967 +44
- Partials 329 332 +3
Continue to review full report in Codecov by Sentry.
|
); | ||
} | ||
const webhook = await db.webhook.get(content.playbackPolicy.webhookId); | ||
if (!webhook) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also! We must check if the webhook can listen to the event playback.accessControl
(or whatever). I know you haven't created it yet, but commenting here as a reminder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still needed 👀
And thinking about it, maybe we should allow fetching an account webhook of the playback.accessControl
type, WDYT? So it defaults to idk the oldest active webhook for that event type, if you don't specify it in the playbackPolicy
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Mostly nits
); | ||
} | ||
const webhook = await db.webhook.get(content.playbackPolicy.webhookId); | ||
if (!webhook) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still needed 👀
And thinking about it, maybe we should allow fetching an account webhook of the playback.accessControl
type, WDYT? So it defaults to idk the oldest active webhook for that event type, if you don't specify it in the playbackPolicy
🤔
(playbackPolicy && asset.playbackPolicy?.type === "webhook") || | ||
playbackPolicy?.type === "webhook" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we actually need a helper like isPrivatePlaybackPolicy
which does the !== public
check, and use it here and in the other place where we choose the OS ID.
Here, the logic we should check is
(playbackPolicy && asset.playbackPolicy?.type === "webhook") || | |
playbackPolicy?.type === "webhook" | |
isPrivatePlaybackPolicy(playbackPolicy) !== isPrivatePlaybackPolicy(asset.playbackPolicy) |
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, I arrived late on this and now I don't want to touch too much, can open a separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah do it. This is not only a nit, the functionality is incomplete (its ignoring jwt policies for example)
b1d2663
to
607f2c1
Compare
What does this pull request do? Explain your changes. (required)
Specific updates (required)
How did you test each of these updates (required)
Does this pull request close any open issues?
Screenshots (optional)
Checklist