sentry: Add user role in user_info object.

As part of issue #15344, the error report emails add the user role
information. This commit adds the user role information to be used
by sentry as well.
This commit is contained in:
Clara Dantas 2020-07-27 22:13:14 -03:00 committed by Alex Vandiver
parent be6b2b248f
commit f9cbefac41
1 changed files with 1 additions and 0 deletions

View File

@ -19,6 +19,7 @@ def add_context(event: 'Event', hint: 'Hint') -> 'Event':
if user_info.get("id"): if user_info.get("id"):
user_profile = get_user_profile_by_id(user_info["id"]) user_profile = get_user_profile_by_id(user_info["id"])
user_info["realm"] = user_profile.realm.string_id or 'root' user_info["realm"] = user_profile.realm.string_id or 'root'
user_info["role"] = user_profile.get_role_name()
return event return event
def setup_sentry(dsn: Optional[str], *integrations: Integration) -> None: def setup_sentry(dsn: Optional[str], *integrations: Integration) -> None: