Skip to content

Commit 6fee8b7

Browse files
check for update access while updating (#3936)
1 parent 0c25485 commit 6fee8b7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

api/restHandler/ChartGroupRestHandler.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,10 @@ func (impl *ChartGroupRestHandlerImpl) SaveChartGroupEntries(w http.ResponseWrit
169169
token := r.Header.Get("token")
170170
rbacObject := request.Name
171171
if ok := impl.enforcer.Enforce(token, casbin.ResourceChartGroup, casbin.ActionCreate, rbacObject); !ok {
172-
common.WriteJsonResp(w, fmt.Errorf("unauthorized user"), "Unauthorized User", http.StatusForbidden)
173-
return
172+
if ok1 := impl.enforcer.Enforce(token, casbin.ResourceChartGroup, casbin.ActionUpdate, rbacObject); !ok1 {
173+
common.WriteJsonResp(w, fmt.Errorf("unauthorized user"), "Unauthorized User", http.StatusForbidden)
174+
return
175+
}
174176
}
175177
//RBAC block ends here
176178
res, err := impl.ChartGroupService.SaveChartGroupEntries(&request)

0 commit comments

Comments
 (0)