john-bodley commented on code in PR #23586:
URL: https://github.com/apache/superset/pull/23586#discussion_r1194511527
##########
superset/views/core.py:
##########
@@ -1846,25 +1847,33 @@ def dashboard(
if not dashboard:
abort(404)
- if config["ENABLE_ACCESS_REQUEST"]:
- for datasource in dashboard.datasources:
- datasource = DatasourceDAO.get_datasource(
- datasource_type=DatasourceType(datasource.type),
- datasource_id=datasource.id,
- session=db.session(),
+ has_access_ = False
+ for datasource in dashboard.datasources:
+ datasource = DatasourceDAO.get_datasource(
+ datasource_type=DatasourceType(datasource.type),
+ datasource_id=datasource.id,
+ session=db.session(),
+ )
+ if datasource and security_manager.can_access_datasource(
+ datasource=datasource,
+ ):
+ has_access_ = True
+
+ if has_access_ is False and config["ENABLE_ACCESS_REQUEST"]:
+ flash(
+
__(security_manager.get_datasource_access_error_msg(datasource)),
+ "danger",
)
- if datasource and not security_manager.can_access_datasource(
- datasource=datasource
- ):
- flash(
- __(
-
security_manager.get_datasource_access_error_msg(datasource)
- ),
- "danger",
- )
- return redirect(
-
f"/superset/request_access/?dashboard_id={dashboard.id}"
- )
+ return redirect(
+ f"/superset/request_access/?dashboard_id={dashboard.id}"
+ )
+
+ if has_access_:
Review Comment:
Why do we break after confirming that they have access to at least one as
opposed to all datasets?
--
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]