This repository has been archived by the owner on Dec 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bad112d
commit 338a4c1
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import json | ||
import requests | ||
|
||
slackAPIToken = "" | ||
oktaAPIToken = "" | ||
oktaGroup = "" | ||
oktaOrg = "" | ||
|
||
slackDeleted = [] | ||
slackBots = [] | ||
slackRestricted = [] | ||
slackUsers = [] | ||
r = requests.get("https://slack.com/api/users.list?token=" + slackAPIToken) | ||
slackUsersJson = r.json() | ||
for user in slackUsersJson['members']: | ||
if (user['deleted'] == True): slackDeleted.append(user['profile']['real_name']) | ||
elif (user['is_bot'] == True): slackBots.append(user['profile']['real_name']) | ||
elif (user['is_restricted'] == True): slackRestricted.append(user['profile']['real_name']) | ||
else: slackUsers.append(user['profile']['email']) | ||
|
||
oktaUsers = [] | ||
r = requests.get("https://" + oktaOrg + ".okta.com/api/v1/groups/" + oktaGroup + "/users", headers={'Authorization': 'SSWS ' + oktaAPIToken}) | ||
oktaUsersJson = r.json() | ||
for user in oktaUsersJson: | ||
oktaUsers.append(user['profile']['login']) | ||
|
||
inSlackNotInOkta = set(slackUsers) - set(oktaUsers) | ||
inOktaNotInSlack = set(oktaUsers) - set(slackUsers) | ||
|
||
print "These people are in Slack and not in Okta" | ||
for user in inSlackNotInOkta: | ||
print user | ||
|
||
print "These people are in Okta and not in Slack" | ||
for user in inOktaNotInSlack : | ||
print user |