Skip to content

Commit dde9ed7

Browse files
committed
WIP
1 parent af6a4ee commit dde9ed7

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

coderd/notifications.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"net/http"
66

77
"github.com/coder/coder/v2/coderd/httpapi"
8+
"github.com/coder/coder/v2/coderd/rbac"
9+
"github.com/coder/coder/v2/coderd/rbac/policy"
810
"github.com/coder/coder/v2/codersdk"
911
)
1012

@@ -49,5 +51,13 @@ func (api *API) notificationsSettings(rw http.ResponseWriter, r *http.Request) {
4951
// @Success 200 {object} codersdk.NotificationsSettings
5052
// @Router /notifications/settings [put]
5153
func (api *API) putNotificationsSettings(rw http.ResponseWriter, r *http.Request) {
54+
ctx := r.Context()
55+
56+
if !api.Authorize(r, policy.ActionUpdate, rbac.ResourceDeploymentConfig) {
57+
httpapi.Write(ctx, rw, http.StatusForbidden, codersdk.Response{
58+
Message: "Insufficient permissions to update notifications settings.",
59+
})
60+
return
61+
}
5262

5363
}

codersdk/notifications.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package codersdk
22

33
type NotificationsSettings struct {
4-
NotifierPaused bool `json:"notifier_paused"`
4+
NotifierPaused bool `json:"notifier_paused" validate:"required"`
55
}

0 commit comments

Comments
 (0)