[CODE-631]: use parent ref in space membership (#226)

This commit is contained in:
Hitesh Aringa 2023-07-24 21:21:09 +00:00 committed by Harness
parent bc5945f8ba
commit 914050c8a1

View File

@ -98,7 +98,8 @@ func (c *Controller) Create(ctx context.Context, session *auth.Session, in *Crea
}
// add space membership to top level space only (as the user doesn't have inhereted permissions alraedy)
if in.ParentID == 0 {
parentRefAsID, err := strconv.ParseInt(in.ParentRef, 10, 64)
if (err == nil && parentRefAsID == 0) || (len(strings.TrimSpace(in.ParentRef)) == 0) {
membership := &types.Membership{
SpaceID: space.ID,
PrincipalID: session.Principal.ID,