This is an automated email from the ASF dual-hosted git repository.
johnbodley pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new e570263 chore(mypy): Fixing can_access_database types (#10119)
e570263 is described below
commit e570263577a9a982bfa9f286ba254306d1002a90
Author: John Bodley <[email protected]>
AuthorDate: Sat Jun 20 21:17:33 2020 -0700
chore(mypy): Fixing can_access_database types (#10119)
Co-authored-by: John Bodley <[email protected]>
---
superset/security/manager.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/superset/security/manager.py b/superset/security/manager.py
index 9888bdd..0107115 100644
--- a/superset/security/manager.py
+++ b/superset/security/manager.py
@@ -50,6 +50,7 @@ from superset.utils.core import DatasourceName
if TYPE_CHECKING:
from superset.common.query_context import QueryContext
from superset.connectors.base.models import BaseDatasource
+ from superset.connectors.druid.models import DruidCluster
from superset.models.core import Database
from superset.sql_parse import Table
from superset.viz import BaseViz
@@ -230,13 +231,16 @@ class SupersetSecurityManager(SecurityManager):
return self.can_access("all_database_access", "all_database_access")
- def can_access_database(self, database: "Database") -> bool:
+ def can_access_database(self, database: Union["Database", "DruidCluster"])
-> bool:
"""
Return True if the user can access the Superset database, False
otherwise.
+ Note for Druid the database is akin to the Druid cluster.
+
:param database: The Superset database
:returns: Whether the user can access the Superset database
"""
+
return (
self.can_access_all_datasources()
or self.can_access_all_databases()