mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-24 13:39:46 -06:00
Merge pull request #31 from owncloud/fix-30
Validation on adding user to group
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user