EnxDev commented on code in PR #43458:
URL: https://github.com/apache/superset/pull/43458#discussion_r3989513064


##########
superset-frontend/src/components/ErrorMessage/DatasourceSecurityAccessErrorMessage.tsx:
##########
@@ -109,7 +110,7 @@ export function DatasourceSecurityAccessErrorMessage({
   const description: ReactNode = (
     <>
       <div>{ownerLine}</div>
-      {extra?.link && (
+      {extra?.link && extra?.is_access_denial && (

Review Comment:
   Could we keep the configured link for table denials here? 
`get_table_access_error_object()` returns `extra.tables` and `extra.link`, but 
not `is_access_denial`, so this condition removes “Request access” from every 
`TABLE_SECURITY_ACCESS_ERROR` (including SQL Lab). The legacy datasource link 
still needs the stricter gate, but table links are safe to render because their 
disclosed table names already appear in the same error. Something like 
`extra.link && (extra.is_access_denial || extra.tables?.length)`, plus a link 
assertion in the table test, would preserve that path.



##########
superset/security/manager.py:
##########
@@ -2473,10 +2490,7 @@ def get_datasource_access_error_msg(
         :returns: The error message
         """
 
-        return (
-            f"This endpoint requires the datasource {datasource.data['id']}, "
-            "database or `all_datasource_access` permission"
-        )
+        return "You do not have permission to access this datasource"

Review Comment:
   Could we wrap this new user-facing 403 message in `_()`? It is serialized as 
`SupersetError.message`, and the table-access message below already uses the 
translation helper. As written, datasource denials stay in English even when 
the rest of the error UI is localized.



-- 
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]

Reply via email to