Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion auth0/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def create_user(self, user: BiocommonsRegisterData) -> Auth0UserData:
resp.raise_for_status()
return Auth0UserData(**resp.json())

def add_roles_to_user(self, user_id: str, role_id: str | list[str]):
def add_roles_to_user(self, user_id: str, role_id: str | list[str]) -> bool:
"""
Add one or more roles to a user. The role(s) must already exist.
"""
Expand Down
3 changes: 1 addition & 2 deletions db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ def add_role(self, role_name: str, auth0_client: Auth0Client, session: Session)
role = Auth0Role.get_by_name(role_name, session)
if role is None:
raise ValueError(f"Role {role_name} not found in DB")
resp = auth0_client.add_roles_to_user(user_id=self.id, role_id=role.id)
resp.raise_for_status()
auth0_client.add_roles_to_user(user_id=self.id, role_id=role.id)

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