1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 07:39:43 +02:00

ember-truth-helpers, allow for no category viewers

This commit is contained in:
Harvey Kandola 2017-09-22 08:52:11 +01:00
parent 3a9675eb14
commit b56d3426d2
7 changed files with 20 additions and 12 deletions

View file

@ -330,6 +330,12 @@ func (h *Handler) SetCategoryPermissions(w http.ResponseWriter, r *http.Request)
return
}
spaceID := request.Query(r, "space")
if len(id) == 0 {
response.WriteMissingDataError(w, method, "space")
return
}
defer streamutil.Close(r.Body)
body, err := ioutil.ReadAll(r.Body)
if err != nil {
@ -346,12 +352,6 @@ func (h *Handler) SetCategoryPermissions(w http.ResponseWriter, r *http.Request)
return
}
if len(model) == 0 {
response.WriteEmpty(w)
return
}
spaceID := model[0].SpaceID
if !HasPermission(ctx, *h.Store, spaceID, permission.SpaceManage, permission.SpaceOwner) {
response.WriteForbiddenError(w)
return