I've messing around with the below script I found, so we can allow some users to forget ssid's. When I forget the wifi, I still get the admin prompt, but if I hit cancel on the prompt, it does forget the ssid. Just trying to figure out how to get the prompt to not show on Sonoma.
#!/bin/bash
# Get a list of preferred Wi-Fi networks
wifiList=$(networksetup -listpreferredwirelessnetworks en0 | sed 's/^\\*//')
# Present a dialog box for selecting a Wi-Fi network to forget
selectedWifi=$(osascript -e 'choose from list {'"${wifiList}"'} with prompt "Select the Wi-Fi network to forget:"' | tr ',' '\\n' | sed -n 2p)
if [ -n "$selectedWifi" ]; then
# Forget the selected Wi-Fi network without requiring admin privileges
sudo -u $USER networksetup -removepreferredwirelessnetwork en0 "$selectedWifi"
echo "Wi-Fi network '$selectedWifi' has been forgotten."
fi
echo "Please select the Wi-Fi network you want to forget."