Skip to content

Instantly share code, notes, and snippets.

@douglascayers
Created March 13, 2023 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save douglascayers/59ab5db325f6f4e08f4abec31b8372dc to your computer and use it in GitHub Desktop.
Save douglascayers/59ab5db325f6f4e08f4abec31b8372dc to your computer and use it in GitHub Desktop.
Ruby script to confirm csv if IP ranges to IP login ranges for Salesforce profile
require "CSV"
items = []
# The ips.csv data comes from copying the HTML table of IP ranges
# from the Salesforce profile in the UI from the org you want to copy.
# Workaround when you don't have metadata api access to the org to copy from.
CSV.foreach("ips.csv") do |row|
items << <<~XML
<loginIpRanges>
<startAddress>#{row[0]}</startAddress>
<endAddress>#{row[1]}</endAddress>
<description>#{row[2]}</description>
</loginIpRanges>
XML
end
File.write("ips.xml", items.map(&:strip).join("\n"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment