amitmiran137 commented on a change in pull request #12875:
URL: https://github.com/apache/superset/pull/12875#discussion_r569426497



##########
File path: superset/security/manager.py
##########
@@ -417,6 +418,27 @@ def can_access_table(self, database: "Database", table: 
"Table") -> bool:
 
         return True
 
+    def raise_for_dashboard_access(self, dashboard: "Dashboard") -> None:
+        from superset.views.base import is_user_admin
+        from superset.views.utils import is_owner
+        from superset.models.dashboard import get_dashboard_access_error_object
+        from superset.views.base import get_user_roles
+
+        has_rbac_access = any(
+            dashboard_role.id in [user_role.id for user_role in 
get_user_roles()]
+            for dashboard_role in dashboard.roles
+        )
+        can_access = (
+            is_user_admin()
+            or is_owner(dashboard, g.user)
+            or (dashboard.published and has_rbac_access)
+        )
+
+        if not can_access:
+            raise SupersetSecurityException(
+                get_dashboard_access_error_object(dashboard)
+            )

Review comment:
       it is being used for access as well
   
https://github.com/apache/superset/blob/abb726df1ba06f4c25e4ce353ea71926ba1a49ca/superset/security/manager.py#L1013




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

Reply via email to