Skip to content

Commit

Permalink
check for update access while updating (#3944)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashish-devtron committed Sep 21, 2023
1 parent e0bce0f commit 0cca0de
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/restHandler/ChartGroupRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,10 @@ func (impl *ChartGroupRestHandlerImpl) SaveChartGroupEntries(w http.ResponseWrit
token := r.Header.Get("token")
rbacObject := request.Name
if ok := impl.enforcer.Enforce(token, casbin.ResourceChartGroup, casbin.ActionCreate, rbacObject); !ok {
common.WriteJsonResp(w, fmt.Errorf("unauthorized user"), "Unauthorized User", http.StatusForbidden)
return
if ok1 := impl.enforcer.Enforce(token, casbin.ResourceChartGroup, casbin.ActionUpdate, rbacObject); !ok1 {
common.WriteJsonResp(w, fmt.Errorf("unauthorized user"), "Unauthorized User", http.StatusForbidden)
return
}
}
//RBAC block ends here
res, err := impl.ChartGroupService.SaveChartGroupEntries(&request)
Expand Down

0 comments on commit 0cca0de

Please sign in to comment.