[server] Set visibleParent wherever the parent changes

This commit is contained in:
Abhishek Shroff
2025-05-16 10:37:07 +05:30
parent 6be5fa3d5e
commit 932ea9e0a0
3 changed files with 8 additions and 4 deletions

View File

@@ -89,6 +89,7 @@ func (r Resource) Move(target string, conflictResolution ResourceBindConflictRes
return err
}
res.parentID = newParentID
res.visibleParent = newParentID
}
return nil
}
@@ -229,6 +230,10 @@ func (r Resource) Copy(target string, id uuid.UUID, recursive bool, conflictReso
return Resource{}, false, err
}
targetRoot.visibleParent = pgtype.UUID{
Bytes: r.id,
Valid: true,
}
targetRoot.f = r.f
targetRoot.userPermission = destParent.userPermission
return targetRoot, deleted, err

View File

@@ -263,6 +263,7 @@ func (f filesystem) insertResource(id, parent uuid.UUID, name string, dir bool,
} else {
r, err := f.collectFullResource(rows)
r.parentID = pgtype.UUID{Bytes: parent, Valid: true}
r.visibleParent = r.parentID
r.inheritedPermissions = permissions
return r, err
}

View File

@@ -131,10 +131,8 @@ func (r Resource) RestoreDeleted(parentPathOrUUID string, name string, autoRenam
return err
} else {
r.name = name
r.parentID = pgtype.UUID{
Bytes: p.id,
Valid: true,
}
r.parentID = pgtype.UUID{Bytes: p.id, Valid: true}
r.visibleParent = r.parentID
}
}
if del, err := f.markNotDeleted(r.id); err != nil {