Hey Guys,
Can't seem to get this work work as planned. Basically I need a way for the end user to be able to turn off the proxies with the least amount of effort. There are also 2 scenarios to this, 1 where they are admins and 2 where they are not admins. Also this has to be able to run when not connected to the JSS. Basically this will be used when at a location that has a captive portal to connect to wi-fi. Once the user has authenticated through the captive portal, they will need to enable the proxy back on for VPN access.
This is what I have so far.
#!/bin/bash
CD="/Users/Shared/CocoaDialog.app/Contents/MacOS/CocoaDialog"
ON='networksetup -setftpproxystate "Wi-Fi" on &&networksetup -setwebproxystate "Wi-Fi" on &&networksetup -setsecurewebproxystate "Wi-Fi" on'
OFF='networksetup -setftpproxystate Wi-Fi off&&networksetup -setwebproxystate Wi-Fi off&&networksetup -setsecurewebproxystate Wi-Fi off'
rv=`$CD msgbox --no-newline
--text "Proxy Toggler"
--informative-text "The Proxy can be toggled on or off."
--button1 "Proxy Off" --button2 "Proxy On" --button3 "Cancel"`
if [ "$rv" == "1" ]; then
eval $OFF
echo "Proxy has been disabled"
elif [ "$rv" == "2" ]; then
eval $ON
echo "Proxy has been enabled"
elif [ "$rv" == "3" ]; then
echo "User has exited"
fi
My current stoppage is that the user has to authenticate 3 times (once for each command).
Also if the user is not an admin, they would not be able to run this script.
Ideally i would like to have the user click the script/command, select if they need the proxy on or off, and never authenticate or authenticate just 1 time.
Doing this through the GUI is 8 clicks, which is too many for some.