Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Commit

Permalink
correctly parse request body
Browse files Browse the repository at this point in the history
  • Loading branch information
refs committed Aug 5, 2020
1 parent 886f75d commit 0db046d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/service/v0/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ func (o Ocs) ListUserGroups(w http.ResponseWriter, r *http.Request) {

// AddToGroup adds a user to a group
func (o Ocs) AddToGroup(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
userid := chi.URLParam(r, "userid")
groupid := r.URL.Query().Get("groupid")
groupid := r.PostForm.Get("groupid")

if groupid == "" {
render.Render(w, r, response.ErrRender(data.MetaBadRequest.StatusCode, "empty group assignment: unspecified group"))
return
}

_, err := o.getGroupsService().AddMember(r.Context(), &accounts.AddMemberRequest{
AccountId: userid,
Expand Down

0 comments on commit 0db046d

Please sign in to comment.