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

list group members & non-members

This commit is contained in:
sauls8t 2018-02-28 14:55:36 +00:00
parent 19b4a3de49
commit 0680a72ee2
15 changed files with 360 additions and 60 deletions

View file

@ -216,3 +216,30 @@ func (h *Handler) Delete(w http.ResponseWriter, r *http.Request) {
response.WriteEmpty(w)
}
// GetGroupMembers returns all users associated with given group.
func (h *Handler) GetGroupMembers(w http.ResponseWriter, r *http.Request) {
method := "group.GetGroupMembers"
ctx := domain.GetRequestContext(r)
// Should be no reason for non-admin to see members
if !ctx.Administrator {
response.WriteForbiddenError(w)
return
}
groupID := request.Param(r, "groupID")
if len(groupID) == 0 {
response.WriteMissingDataError(w, method, "groupID")
return
}
m, err := h.Store.Group.GetGroupMembers(ctx, groupID)
if err != nil {
response.WriteServerError(w, method, err)
h.Runtime.Log.Error(method, err)
return
}
response.WriteJSON(w, m)
}