@rderewianko helped me figure out how to check what account someone is signed in with in Google Chrome. We're a Google for Work shop so want to make sure people are signed in like we recommend so their bookmarks and settings are saved to their account for ease of use. Could also be useful for troubleshooting I suppose. If someone is signed into Chrome with multiple accounts it will display all of them.
Next step I'd like to do is detect when the yellow warning icon appears in Chrome, where an account's password needs to be re-entered and Chrome currently is not saving anything to the account.
#!/bin/sh
#
# check-chrome-users.sh
#
# Extension attribute to report which accounts
# are logged into Google Chrome on a Mac.
#
# For use as a JAMF Casper Suite extension attribute
#
# Adam Codega, Swipely
#
loggedinuser=`python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");'`
chromestate=`cat /Users/$loggedinuser/Library/Application Support/Google/Chrome/Local State | grep user_name`
echo "<result>$chromestate</result>"