guard against possible empty groups

This commit is contained in:
A.Unger
2021-04-13 11:48:11 +02:00
parent f23cf92153
commit c6951d2e05

View File

@@ -28,8 +28,10 @@ func (o Ocs) ListUserGroups(w http.ResponseWriter, r *http.Request) {
// short circuit if there is a user already in the context
if u, ok := user.ContextGetUser(r.Context()); ok {
mustNotFail(render.Render(w, r, response.DataRender(&data.Groups{Groups: u.Groups})))
return
if len(u.Groups) > 0 {
mustNotFail(render.Render(w, r, response.DataRender(&data.Groups{Groups: u.Groups})))
return
}
}
if isValidUUID(userid) {