+ if direction == :search_up
+ # Follow upstream collections referenced in the script parameters
+ find_collections(visited, job) do |hash, uuid|
+ search_edges(visited, hash, :search_up) if hash
+ search_edges(visited, uuid, :search_up) if uuid
+ end
+ elsif direction == :search_down
+ # Follow downstream job output
+ search_edges(visited, job.output, direction)
+ end
+ end
+ elsif rsc == Collection
+ if c = Collection.readable_by(*@read_users).where(uuid: uuid).limit(1).first
+ search_edges(visited, c.portable_data_hash, direction)
+ visited[c.portable_data_hash] = c.as_api_response