Skip to content

Commit d7c6ebb

Browse files
committed
Fix: Member without phone number could not login
Apparently, applications are also returned when listing the users from the Accessy API. But they don't have the "msisdn", so we can filter on that.
1 parent 7d434f1 commit d7c6ebb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

api/src/multiaccessy/accessy.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,15 @@ def _get_user_details(self, user_id: UUID) -> Any:
477477

478478
def _get_users_org(self) -> list[dict]:
479479
"""Get all user ID:s"""
480-
return self._get_json_paginated(f"/asset/admin/organization/{self.organization_id()}/user")
480+
481+
def is_application(user: dict) -> bool:
482+
return user.get("msisdn", None) is None
483+
484+
return [
485+
v
486+
for v in self._get_json_paginated(f"/asset/admin/organization/{self.organization_id()}/user")
487+
if not is_application(v)
488+
]
481489
# {"items":[{"id":<uuid>,"msisdn":"+46...","firstName":str,"lastName":str}, ...],"totalItems":6,"pageSize":25,"pageNumber":0,"totalPages":1}
482490

483491
def _get_users_in_access_group(self, access_group_id: UUID) -> list[dict]:

0 commit comments

Comments
 (0)