Skip to content

Commit 1f36d90

Browse files
committed
fix: incorrect response handling in BioCommonsUser.add_role()
1 parent 5826b67 commit 1f36d90

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

auth0/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def create_user(self, user: BiocommonsRegisterData) -> Auth0UserData:
150150
resp.raise_for_status()
151151
return Auth0UserData(**resp.json())
152152

153-
def add_roles_to_user(self, user_id: str, role_id: str | list[str]):
153+
def add_roles_to_user(self, user_id: str, role_id: str | list[str]) -> bool:
154154
"""
155155
Add one or more roles to a user. The role(s) must already exist.
156156
"""

db/models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ def add_role(self, role_name: str, auth0_client: Auth0Client, session: Session)
131131
role = Auth0Role.get_by_name(role_name, session)
132132
if role is None:
133133
raise ValueError(f"Role {role_name} not found in DB")
134-
resp = auth0_client.add_roles_to_user(user_id=self.id, role_id=role.id)
135-
resp.raise_for_status()
134+
auth0_client.add_roles_to_user(user_id=self.id, role_id=role.id)
136135

137136
def add_platform_membership(
138137
self, platform: PlatformEnum, db_session: Session, auth0_client: Auth0Client, auto_approve: bool = False

0 commit comments

Comments
 (0)