villebro commented on a change in pull request #13992:
URL: https://github.com/apache/superset/pull/13992#discussion_r610642640
##########
File path: superset/security/manager.py
##########
@@ -994,8 +996,14 @@ def raise_for_access( # pylint:
disable=too-many-arguments,too-many-branches
assert datasource
+ from superset.extensions import feature_flag_manager
+
if not (
- self.can_access_schema(datasource)
+ (
+ feature_flag_manager.is_feature_enabled("DASHBOARD_RBAC")
+ and self.can_access_based_on_dashboard(datasource)
+ )
+ or self.can_access_schema(datasource)
Review comment:
Can we put the new assertion last on the list? As it's slightly more
expensive than the other ones here, I think it might be a good idea to do the
less expensive checks first.
##########
File path: superset/security/manager.py
##########
@@ -1125,3 +1133,24 @@ def raise_for_dashboard_access(self, dashboard:
"Dashboard") -> None:
if not can_access:
raise DashboardAccessDeniedError()
+
+ # pylint: disable=no-self-use
+ def can_access_based_on_dashboard(self, datasource: "BaseDatasource") ->
bool:
Review comment:
This can probably be made `@staticmethod` if we're not referencing
`self` here, removing the need to ignore linter errors.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]