mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
fix: create virtual dataset validation (#26625)
This commit is contained in:
committed by
Michael S. Molina
parent
912852c797
commit
b9a92b41d7
@@ -27,11 +27,13 @@ from superset.daos.exceptions import DAOCreateFailedError
|
||||
from superset.datasets.commands.exceptions import (
|
||||
DatabaseNotFoundValidationError,
|
||||
DatasetCreateFailedError,
|
||||
DatasetDataAccessIsNotAllowed,
|
||||
DatasetExistsValidationError,
|
||||
DatasetInvalidError,
|
||||
TableNotFoundValidationError,
|
||||
)
|
||||
from superset.extensions import db
|
||||
from superset.exceptions import SupersetSecurityException
|
||||
from superset.extensions import db, security_manager
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -82,6 +84,15 @@ class CreateDatasetCommand(CreateMixin, BaseCommand):
|
||||
):
|
||||
exceptions.append(TableNotFoundValidationError(table_name))
|
||||
|
||||
if sql:
|
||||
try:
|
||||
security_manager.raise_for_access(
|
||||
database=database,
|
||||
sql=sql,
|
||||
schema=schema,
|
||||
)
|
||||
except SupersetSecurityException as ex:
|
||||
exceptions.append(DatasetDataAccessIsNotAllowed(ex.error.message))
|
||||
try:
|
||||
owners = self.populate_owners(owner_ids)
|
||||
self._properties["owners"] = owners
|
||||
|
||||
Reference in New Issue
Block a user