Posted on 08-01-2023 02:55 AM
Hello
I would like to ask if there is a way to "scope" the Jamf Pro admin interface?
To give some context, we have Support teams in several countries and we will have them do basic Mac management soon. However, I would like them to be able to see only the Macs from their specific countries, and not the others.
Thanks
Posted on 08-01-2023 04:52 AM
You would do this with JAMF sites, but it is probably more work then its worth.
Posted on 08-01-2023 07:58 AM
Hey @DenisT ! You could use an EA to determine the computer's country based on IP, or you could grab the set locale information to determine.
Country By IP (VPNs could give inaccurate results, just FYI):
#!/bin/bash
# Gathers the country of the computer based on IP address
# Created 10.27.2022 @robjschroeder
jamfURL=$(defaults read /Library/Preferences/com.jamfsoftware.jamf.plist jss_url)
externalIP=$(curl -s ifconfig.me)
geoData=$(curl -s -H "User-Agent: keycdn-tools:${jamfURL}" "https://tools.keycdn.com/geo.json?host=${externalIP}" 2>&1)
if [[ $externalIP ]]; then
geoData=$(curl -s -H "User-Agent: keycdn-tools:${jamfURL}" "https://tools.keycdn.com/geo.json?host=${externalIP}" 2>&1)
# echo $geoData
country=$(echo ${geoData} | plutil -extract "data"."geo"."country_name" raw -o - -)
else
RESULT="Error - IP Address lookup failed"
fi
if [[ ${country} ]]; then
RESULT=${country}
fi
echo "<result>${RESULT}</result>"
Apple Locale Information (User's could have chosen an inaccurate region during Setup Assistant, FYI):
#!/bin/bash
# Determine user location based on region selected during Setup Assistant
# @robjschroeder 08.01.2023
# Gather the logged in User
loggedInUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
# Determine locale
locale=$(defaults read /Users/$loggedInUser/Library/Preferences/.GlobalPreferences.plist AppleLocale)
echo "<result>$locale</result>"
08-01-2023 09:19 AM - edited 08-01-2023 09:20 AM
two liner.. but many ways as ever.. 😎
result=$(/usr/bin/curl ipinfo.io -s | awk '/"country": / { print $NF }' | tr -d ' ",')
echo "<result>$result</result>"
Posted on 08-02-2023 05:54 AM
Nice!
Posted on 08-07-2023 07:13 AM
I think Sites is the way to go here.