You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "michael-s-molina (via GitHub)" <gi...@apache.org> on 2023/08/08 16:43:27 UTC

[GitHub] [superset] michael-s-molina commented on a diff in pull request #24903: fix(charts): View in SQL Lab with relevant perm

michael-s-molina commented on code in PR #24903:
URL: https://github.com/apache/superset/pull/24903#discussion_r1287397363


##########
superset-frontend/src/dashboard/util/permissionUtils.ts:
##########
@@ -58,8 +57,12 @@ export function canUserAccessSqlLab(
   return (
     isUserAdmin(user) ||
     (isUserWithPermissionsAndRoles(user) &&
-      Object.keys(user.roles || {}).some(
-        role => role.toLowerCase() === SQL_LAB_ROLE,
-      ))
+      Object.values(user.roles || {})
+        .flat()
+        .some(
+          permissionView =>
+            permissionView[0] === 'menu_access' &&

Review Comment:
   `canUserAccessSqlLab` is called from places where a menu is not present such as the home page. Could you change the code to request the `menu_access` permission at the places where a menu is present?



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org