Last active
July 16, 2019 13:28
-
-
Save felubra/8dde8962765fd58661d42e72a0dbdb70 to your computer and use it in GitHub Desktop.
Extracts the user e-mails from the Imail's Web Admin Interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** | |
* Extracts the user e-mails from the Imail's Web Admin Interface. | |
* Endpoint: UserAdmin.aspx | |
*/ | |
function getUsersFromComponent(byLine = false) { | |
const domain = document.querySelector('span#ctl00_ContentPlaceHolder2_dsDomains_lblDomainName').innerText; | |
const users = ctl00_ContentPlaceHolder2_grdUsers.Data.reduce((accUsers, user) => { | |
const userName = user[1].toLowerCase(); | |
const isSysAdmin = user[3] === 'Yes'; | |
const isDomainAdmin = user[4] === 'Yes'; | |
const isListAdmin = user[5] === 'Yes'; | |
const isEnabled = user[6] === 'Yes'; | |
if (isEnabled && !(isSysAdmin || isDomainAdmin || isListAdmin)) accUsers.push(userName+'@'+domain); | |
return accUsers; | |
}, []); | |
return byLine ? users.sort().join('\n') : users; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment