bmaquet commented on code in PR #32770:
URL: https://github.com/apache/superset/pull/32770#discussion_r2005941656
##########
superset/utils/core.py:
##########
@@ -1292,6 +1292,19 @@ def get_user_email() -> str | None:
return None
+def get_user_roles() -> list[str] | None:
+ """
+ Get the roles (if defined) associated with the current user.
+
+ :returns: The roles
+ """
+
+ try:
+ return [role.name for role in g.user.roles]
Review Comment:
I decided to rely on the same general exception handling that is used in the
[other functions to get user
attributes](https://github.com/apache/superset/blob/master/superset/utils/core.py#L1251-L1292).
In `superset/jinja_context.py`, there's no exception handling at all
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]