mirror of
https://codeberg.org/shroff/phylum.git
synced 2026-01-06 03:31:02 -06:00
[server] Set visibleParent wherever the parent changes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user