|
|
@@ -2,6 +2,7 @@ package v1
|
|
|
|
|
|
import (
|
|
|
"github.com/runningwater/gohub/app/models/topic"
|
|
|
+ "github.com/runningwater/gohub/app/policies"
|
|
|
"github.com/runningwater/gohub/app/requests"
|
|
|
"github.com/runningwater/gohub/pkg/auth"
|
|
|
"github.com/runningwater/gohub/pkg/response"
|
|
|
@@ -51,6 +52,11 @@ func (ctrl *TopicsController) Update(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ if !policies.CanModifyTopic(c, topicModel) {
|
|
|
+ response.Abort403(c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
topicModel.Title = request.Title
|
|
|
topicModel.Body = request.Body
|
|
|
topicModel.CategoryID = request.CategoryID
|