Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mir-scripts-user-association #191

Open
wants to merge 1 commit into
base: v2.0.0-code
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions odins_spear/scripts/user_association.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def main(api, service_provider_id: str, group_id: str, user_id: str):
}

try:
user = api.get.user_report(user_id)
user = api.reports.get_user_report(user_id)
except Exception:
return f"User {user_id} not found."

Expand All @@ -41,21 +41,23 @@ def main(api, service_provider_id: str, group_id: str, user_id: str):
USER_DATA["featurePacks"] = user["servicePacks"]
USER_DATA["aliases"] = user["aliases"]

pick_up_group = api.get.call_pickup_group_user(
pick_up_group = api.call_pickup.get_call_pickup_group_user(
service_provider_id, group_id, user_id
)
try:
USER_DATA["pickUpGroup"] = pick_up_group[0]["name"]
except IndexError:
USER_DATA["pickUpGroup"] = None

hunt_groups = api.get.group_hunt_group_user(service_provider_id, group_id, user_id)
hunt_groups = api.hunt_groups.get_group_hunt_group_user(
service_provider_id, group_id, user_id
)
for hg in tqdm(hunt_groups, desc="Fetching Hunt Groups"):
USER_DATA["huntGroups"].append(hg["serviceUserId"])

# if the user does not have a license for CC this call errors
try:
call_centers = api.get.user_call_center(user_id)
call_centers = api.call_centers.get_user_call_center(user_id)
for cc in tqdm(call_centers["callCenters"], desc="Fetching Call Centers"):
USER_DATA["callCenters"].append(cc["serviceUserId"])
except Exception:
Expand Down