From fce9f0d0945aaedb02353ec619f7ac9c943aea70 Mon Sep 17 00:00:00 2001 From: "Michael J. Stealey" Date: Wed, 23 Oct 2024 13:49:52 -0400 Subject: [PATCH] [#88] fix role delete/create issue str vs. int --- server/swagger_server/response_code/comanage_utils.py | 4 ++-- server/swagger_server/response_code/whoami_controller.py | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/server/swagger_server/response_code/comanage_utils.py b/server/swagger_server/response_code/comanage_utils.py index e63e736..ea10e26 100644 --- a/server/swagger_server/response_code/comanage_utils.py +++ b/server/swagger_server/response_code/comanage_utils.py @@ -283,8 +283,8 @@ def update_people_roles(fab_person_id: int, co_person_id: int) -> None: fab_person = FabricPeople.query.filter_by(id=fab_person_id).one_or_none() co_roles = api.coperson_roles_view_per_coperson(coperson_id=co_person_id).get('CoPersonRoles', []) fab_roles = fab_person.roles - co_role_ids = [r.get('Id') for r in co_roles] - fab_role_ids = [str(r.co_person_role_id) for r in fab_roles] + co_role_ids = [int(r.get('Id')) for r in co_roles] + fab_role_ids = [int(r.co_person_role_id) for r in fab_roles] roles_added = array_difference(co_role_ids, fab_role_ids) roles_removed = array_difference(fab_role_ids, co_role_ids) # remove old Fabric roles diff --git a/server/swagger_server/response_code/whoami_controller.py b/server/swagger_server/response_code/whoami_controller.py index 0e12bc7..514b18d 100644 --- a/server/swagger_server/response_code/whoami_controller.py +++ b/server/swagger_server/response_code/whoami_controller.py @@ -22,9 +22,8 @@ def whoami_get() -> Whoami: # noqa: E501 try: # get person from people table api_user, id_source = get_person_by_login_claims() - print(id_source) - if id_source in []: - pass + if id_source in ['exception']: + consoleLogger.info('WARNING: Exception detected: get_person_by_login_claims') if not api_user.co_person_id: details = 'Enrollment required: {0}'.format(os.getenv('CORE_API_401_UNAUTHORIZED_TEXT')) consoleLogger.info("unauthorized_access(): {0}".format(details))