fix recursive json marshaling
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
@@ -257,8 +257,11 @@ func (s Service) AddMember(c context.Context, in *proto.AddMemberRequest, out *p
|
|||||||
alreadyRelated = true
|
alreadyRelated = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
aref := &proto.Account{
|
||||||
|
Id: a.Id,
|
||||||
|
}
|
||||||
if !alreadyRelated {
|
if !alreadyRelated {
|
||||||
g.Members = append(g.Members, a)
|
g.Members = append(g.Members, aref)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if we need to add the group to the account
|
// check if we need to add the group to the account
|
||||||
@@ -269,8 +272,12 @@ func (s Service) AddMember(c context.Context, in *proto.AddMemberRequest, out *p
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// only store the reference to prevent recurision when marshaling json
|
||||||
|
gref := &proto.Group{
|
||||||
|
Id: g.Id,
|
||||||
|
}
|
||||||
if !alreadyRelated {
|
if !alreadyRelated {
|
||||||
a.MemberOf = append(a.MemberOf, g)
|
a.MemberOf = append(a.MemberOf, gref)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = s.repo.WriteAccount(c, a); err != nil {
|
if err = s.repo.WriteAccount(c, a); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user