Created
March 13, 2023 16:14
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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