Skip to content

Commit

Permalink
Merge branch 'jc/deactivate-disabled-account' into autostaging
Browse files Browse the repository at this point in the history
  • Loading branch information
jingcheng16 committed Jul 22, 2024
2 parents 428cd80 + 4058aeb commit 405fdb6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions corehq/apps/sso/utils/entra.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _get_user_principal_names(user_ids, token):
{
"id": str(i),
"method": "GET",
"url": f"/users/{principal_id}?$select=userPrincipalName"
"url": f"/users/{principal_id}?$select=userPrincipalName,accountEnabled"
} for i, principal_id in enumerate(chunk)
]
}
Expand All @@ -96,7 +96,8 @@ def _get_user_principal_names(user_ids, token):

# Extract userPrincipalName from batch response
for resp in batch_result['responses']:
if 'body' in resp and 'userPrincipalName' in resp['body']:
if ('body' in resp and 'userPrincipalName' in resp['body']
and resp['body'].get('accountEnabled') is True):
user_principal_names.append(resp['body']['userPrincipalName'])

return user_principal_names
Expand Down

0 comments on commit 405fdb6

Please sign in to comment.