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

100 review scripter features return only json new #119

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion odins_spear/scripts/aa_cc_hg_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ def main(api, service_provider_id: str, group_id: str):
del aa_cc_hg["typeTag"]
return_data["huntGroups"].append(aa_cc_hg)

return json.dumps(return_data)
return return_data


6 changes: 3 additions & 3 deletions odins_spear/scripts/bulk_password_reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def main(api, service_provider_id: str, group_id: str, users: list, password_typ

print("Setting new SIP passwords complete.")
formatted_user_and_new_passwords = [{"userId": user[0], "newPassword": user[1]} for user in users_and_new_passwords]
return json.dumps(formatted_user_and_new_passwords)
return formatted_user_and_new_passwords

# intigration password
elif password_type.lower() == "web":
Expand All @@ -32,7 +32,7 @@ def main(api, service_provider_id: str, group_id: str, users: list, password_typ

print("Setting new SIP passwords complete.")
formatted_user_and_new_passwords = [{"userId": user[0], "newPassword": user[1]} for user in users_and_new_passwords]
return json.dumps(formatted_user_and_new_passwords)
return formatted_user_and_new_passwords

# voicemail/ oortal
elif password_type.lower() == "vm": # voicemail
Expand All @@ -47,7 +47,7 @@ def main(api, service_provider_id: str, group_id: str, users: list, password_typ

print("Setting new voicemail passcodes complete.")
formatted_user_and_new_passcodes = [{"userId": user[0], "newPasscode": user[1]} for user in users_and_new_passcodes]
return json.dumps(formatted_user_and_new_passcodes)
return formatted_user_and_new_passcodes

# raise error if user attempts to change another type of password.
else:
Expand Down
20 changes: 15 additions & 5 deletions odins_spear/scripts/find_alias.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import re
from tqdm import tqdm

from ..exceptions import OSAliasNotFound


def locate_alias(alias, aliases: list):
for a in aliases:
if re.search(rf'\b{alias}\b', a):
Expand Down Expand Up @@ -108,15 +111,22 @@ def main(api, service_provider_id: str, group_id: str, alias: str):
for broadwork_entity in tqdm(OBJECT_WITH_ALIAS, desc=f"Searching AA, HG, and CC for alias {alias}"):

if locate_alias(alias, broadwork_entity['aliases']):
return f"""
Alias ({alias}) found: {broadwork_entity['type']} - {broadwork_entity['name']}"""
return {
"alias":alias,
"service_user_id": broadwork_entity[1],
"type":broadwork_entity[0]
}

users = api.get.users(service_provider_id, group_id, extended=True)
print("Fetched users.")

for user in tqdm(users, desc=f"Searching Users for alias: {alias}"):

if locate_alias(alias, user['aliases']):
return f"\n\n\tAlias ({alias}) found: User - {user['userId']}\n"
return {
"alias": alias,
"user_id": user['userId'],
"type": "user"
}

return f"\n\n\tAlias ({alias}) not found."
return OSAliasNotFound
4 changes: 1 addition & 3 deletions odins_spear/scripts/service_pack_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,4 @@ def main(api, service_provider_id, group_id):

assigned_service_pack_services.append(sps)

return json.dumps({
"servicePackServices": assigned_service_pack_services
Chopped4Life marked this conversation as resolved.
Show resolved Hide resolved
})
return {"servicePackServices": assigned_service_pack_services}
2 changes: 1 addition & 1 deletion odins_spear/scripts/service_provider_trunking_capacity.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@ def main(api: object, service_provider_id: str):
return_data["callCapacityDifference"] = return_data["maxActiveCalls"] - return_data["groupsCallCapacityTotal"]
return_data["burstingCallCapacityDifference"] = return_data["burstingMaxActiveCalls"] - return_data["groupsBurstingCallCapacityTotal"]

return json.dumps(return_data)
return return_data
2 changes: 1 addition & 1 deletion odins_spear/scripts/user_association.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ def main(api, service_provider_id: str, group_id: str, user_id: str):
except Exception:
USER_DATA["callCenters"] = None

return json.dumps(USER_DATA)
return USER_DATA