Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9a1a605

Browse files
committed
auth on test notification endpoint
1 parentef22b35 commit9a1a605

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎coderd/notifications.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,12 @@ func (api *API) postUserPushNotificationTest(rw http.ResponseWriter, r *http.Req
428428
return
429429
}
430430

431+
// We need to authorize the user to send a push notification to themselves.
432+
if!api.Authorize(r,policy.ActionCreate,rbac.ResourceNotificationMessage.WithOwner(user.ID.String())) {
433+
httpapi.Forbidden(rw)
434+
return
435+
}
436+
431437
iferr:=api.WebpushDispatcher.Dispatch(ctx,user.ID, codersdk.WebpushMessage{
432438
Title:"It's working!",
433439
Body:"You've subscribed to push notifications.",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp