add types of group

This commit is contained in:
soukainna
2022-11-08 16:49:42 +01:00
parent 556f8a24c0
commit 6364056ae1
4 changed files with 38 additions and 4 deletions

View File

@@ -69,11 +69,18 @@ func (h *ApplicationHandler) CreateGroupModule(w http.ResponseWriter, r *http.Re
w.WriteHeader(http.StatusBadRequest)
return
}
if r.FormValue("type") == "" {
fmt.Println("invalid type")
w.WriteHeader(http.StatusBadRequest)
return
}
groupid := uuid.NewString()
dataMap := map[string]any{
"name": r.FormValue("name"),
"type": r.FormValue("type"),
}
data, err := structpb.NewValue(dataMap)
@@ -101,7 +108,8 @@ func (h *ApplicationHandler) CreateGroupModule(w http.ResponseWriter, r *http.Re
http.Redirect(w, r, fmt.Sprintf("/app/group_module/groups/%s", groupid), http.StatusFound)
return
}
h.Renderer.CreateGroupModule(w, r)
group_types := h.config.GetStringSlice("modules.groups.group_types")
h.Renderer.CreateGroupModule(w, r, group_types)
}
func filterAcccount(r *http.Request, a *mobilityaccounts.Account) bool {