Enterprise Connect - extension attribute to show login status

jtrant
Valued Contributor

Hi there,

I'm wondering if anyone has tried to create an Extension Attribute to show whether Enterprise Connect is active and the user is logged in?

Having the client is one thing, but I'd like to find out which users are actually logged into the client.

Thanks a lot!
Justin.

3 REPLIES 3

dan-snelson
Valued Contributor II

@jtrant We're using the following to capture the username:

#!/bin/bash

####################################################################################################
# Extension Attribute to determine the Enterprise Connect Username
####################################################################################################

# Get the logged-in user's username
loggedInUser=$( /usr/bin/stat -f %Su "/dev/console" )

if [[ ${loggedInUser} == "root" ]]  || [[ ${loggedInUser} == "localadmin" ]] || [[ ${loggedInUser} == "adobeinstall" ]] || [[ ${loggedInUser} == "_mbsetupuser" ]] ; then

    result="${loggedInUser}"

else

    if [[ -e "/Applications/Enterprise Connect.app/Contents/SharedSupport/eccl" ]] ; then

        adUsername=$( /usr/bin/su - "${loggedInUser}" -c "/Applications/Enterprise Connect.app/Contents/SharedSupport/eccl -p adUsername" | /usr/bin/sed 's/adUsername: //' )

        if [[ ${adUsername} == "missing value" ]]; then   # Enterprise Connect installed, but user is NOT logged in

            result="${loggedInUser} NOT logged into Enterprise Connect"

        else    # Enterprise Connect installed and the user is logged in

            result="${adUsername}"

        fi

    else

        result="${loggedInUser} NOT logged into Enterprise Connect; eccl missing"

    fi

fi

echo "<result>${result}</result>"

exit 0

dan-snelson
Valued Contributor II

Signed-in Status would be:

/Applications/Enterprise Connect.app/Contents/SharedSupport/eccl -p signedInStatus | /usr/bin/sed 's/signedInStatus: //'

jtrant
Valued Contributor

That's exactly what I'm looking for. Thank you Dan!