Antho script again.
This commit is contained in:
@ -118,13 +118,42 @@ def grab_ppl_ids(rowdict):
|
|||||||
|
|
||||||
if len(person_list) > 0:
|
if len(person_list) > 0:
|
||||||
cprint(f"Person list for knowledgestate.edu has {len(person_list)} people.", 'blue')
|
cprint(f"Person list for knowledgestate.edu has {len(person_list)} people.", 'blue')
|
||||||
bulk_remove_and_enroll(person_list, KNOWLEDGEGROUPS)
|
# bulk_remove_and_enroll(person_list, KNOWLEDGEGROUPS)
|
||||||
|
add_group_to_people(person_list)
|
||||||
else:
|
else:
|
||||||
cprint(f"Person list for knowledgestate.edu has {len(person_list)} people.", 'blue')
|
cprint(f"Person list for knowledgestate.edu has {len(person_list)} people.", 'blue')
|
||||||
cprint(f"Skipping the bulk function.", 'yellow')
|
cprint(f"Skipping the bulk function.", 'yellow')
|
||||||
|
|
||||||
def add_group_to_people(person_list):
|
def add_group_to_people(person_list):
|
||||||
pass
|
""" Currently set to add the 3 Ally - (Tx) groups to the knowledgestate people"""
|
||||||
|
addpayload = { "data": [
|
||||||
|
{
|
||||||
|
"id": "7395831e-4325-4b16-85bb-36c94f68aec0",
|
||||||
|
"type": "membership-groups"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "180571e8-f943-4980-8997-b3eed2a0c141",
|
||||||
|
"type": "membership-groups"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "2b69f2f8-d567-48c3-8bb3-22e0dc8819bd",
|
||||||
|
"type": "membership-groups"
|
||||||
|
}
|
||||||
|
] }
|
||||||
|
for person_uuid in person_list:
|
||||||
|
addurl = f"{BASEURL}people/{person_uuid}/relationships/groups"
|
||||||
|
try:
|
||||||
|
addreq = requests.post(addurl, headers=HEADERS, json=addpayload)
|
||||||
|
good_status_codes = [202, 204, 200, 203]
|
||||||
|
if addreq.status_code in good_status_codes:
|
||||||
|
print("Passed!")
|
||||||
|
print(addreq.status_code)
|
||||||
|
else:
|
||||||
|
cprint(f"Error: {addreq.status_code} with {person_uuid}", 'red')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
finally:
|
||||||
|
pass
|
||||||
|
|
||||||
def bulk_remove_and_enroll(person_list, group_list):
|
def bulk_remove_and_enroll(person_list, group_list):
|
||||||
cprint("Moving people and groups into bulk function.", 'green')
|
cprint("Moving people and groups into bulk function.", 'green')
|
||||||
|
|||||||
Reference in New Issue
Block a user