You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/06/16 00:49:10 UTC
[GitHub] [superset] betodealmeida opened a new pull request #15184: fix: datasource payload is incorrect
betodealmeida opened a new pull request #15184:
URL: https://github.com/apache/superset/pull/15184
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
We currently return all datasources in the `/datasources/` and `/chart/add` endpoints. This PR changes the payload to have only user-accessible datasources.
The PR adds a new method `get_user_datasources`, which replaces `get_all_datasources` in the two views.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
N/A
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
Will add unit tests, wanted to check the approach first.
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] john-bodley commented on a change in pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
john-bodley commented on a change in pull request #15184:
URL: https://github.com/apache/superset/pull/15184#discussion_r660129674
##########
File path: superset/connectors/connector_registry.py
##########
@@ -99,6 +100,41 @@ def get_datasource_by_id( # pylint: disable=too-many-arguments
pass
raise NoResultFound(_("Datasource id not found: %(id)s", id=datasource_id))
+ @classmethod
+ def get_user_datasources(cls, session: Session) -> List["BaseDatasource"]:
+ from superset import security_manager
+
+ # collect datasources which the user has explicit permissions to
+ user_perms = security_manager.user_view_menu_names("datasource_access")
+ schema_perms = security_manager.user_view_menu_names("schema_access")
+ user_datasources = set()
+ for datasource_class in ConnectorRegistry.sources.values():
+ user_datasources.update(
+ session.query(datasource_class)
Review comment:
@dpgaspar that's correct. We actually don't use any of the FAB logic and thus we completely bypass the `securiy_manager.user_view_menu_names` and reliance of the `datasource_class.perm` and `datasource_class.schema_perm` database columns.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov[bot] commented on pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on pull request #15184:
URL: https://github.com/apache/superset/pull/15184#issuecomment-861938209
# [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#15184](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (31e46a6) into [master](https://codecov.io/gh/apache/superset/commit/cc2b4fe3f471814fb75c1c8bce97867c96caaec7?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (cc2b4fe) will **decrease** coverage by `0.18%`.
> The diff coverage is `100.00%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/15184/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #15184 +/- ##
==========================================
- Coverage 77.54% 77.35% -0.19%
==========================================
Files 967 967
Lines 49752 49809 +57
Branches 6351 6351
==========================================
- Hits 38578 38532 -46
- Misses 10972 11075 +103
Partials 202 202
```
| Flag | Coverage Δ | |
|---|---|---|
| hive | `?` | |
| mysql | `?` | |
| postgres | `81.72% <100.00%> (-0.02%)` | :arrow_down: |
| python | `81.76% <100.00%> (-0.36%)` | :arrow_down: |
| sqlite | `81.35% <100.00%> (-0.01%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [superset/views/chart/views.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY2hhcnQvdmlld3MucHk=) | `88.63% <ø> (ø)` | |
| [superset/views/core.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY29yZS5weQ==) | `75.11% <ø> (-0.45%)` | :arrow_down: |
| [superset/connectors/connector\_registry.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9jb25uZWN0b3JfcmVnaXN0cnkucHk=) | `90.14% <100.00%> (+3.86%)` | :arrow_up: |
| [superset/db\_engines/hive.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lcy9oaXZlLnB5) | `0.00% <0.00%> (-82.15%)` | :arrow_down: |
| [superset/db\_engine\_specs/hive.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2hpdmUucHk=) | `69.20% <0.00%> (-18.20%)` | :arrow_down: |
| [superset/exceptions.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZXhjZXB0aW9ucy5weQ==) | `93.50% <0.00%> (-5.20%)` | :arrow_down: |
| [superset/db\_engine\_specs/mysql.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL215c3FsLnB5) | `92.85% <0.00%> (-4.29%)` | :arrow_down: |
| [superset/databases/commands/create.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL2NyZWF0ZS5weQ==) | `88.23% <0.00%> (-3.93%)` | :arrow_down: |
| [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `81.03% <0.00%> (-1.73%)` | :arrow_down: |
| [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `83.36% <0.00%> (-1.06%)` | :arrow_down: |
| ... and [14 more](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [cc2b4fe...31e46a6](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] john-bodley commented on a change in pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
john-bodley commented on a change in pull request #15184:
URL: https://github.com/apache/superset/pull/15184#discussion_r657430908
##########
File path: superset/connectors/connector_registry.py
##########
@@ -99,6 +100,41 @@ def get_datasource_by_id( # pylint: disable=too-many-arguments
pass
raise NoResultFound(_("Datasource id not found: %(id)s", id=datasource_id))
+ @classmethod
+ def get_user_datasources(cls, session: Session) -> List["BaseDatasource"]:
+ from superset import security_manager
+
+ # collect datasources which the user has explicit permissions to
+ user_perms = security_manager.user_view_menu_names("datasource_access")
+ schema_perms = security_manager.user_view_menu_names("schema_access")
+ user_datasources = set()
+ for datasource_class in ConnectorRegistry.sources.values():
+ user_datasources.update(
+ session.query(datasource_class)
Review comment:
@betodealmeida @dpgaspar I believe this logic, i.e., relying on the fragile `perm` and `schema_perm` columns in the database, breaks if people are using a custom security manager. Should we be calling [get_datasources_accessible_by_user](https://github.com/apache/superset/blob/a06a2f30af02820189450b2264fa6bb734507ed8/superset/security/manager.py#L508) instead?
Note I sense currently Superset doesn't do a great job of differentiating between metadata and data access. The `get_datasources_accessible_by_user` is somewhat of a misnomer as it is merely used for metadata access (for an awareness perspective).
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov[bot] edited a comment on pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #15184:
URL: https://github.com/apache/superset/pull/15184#issuecomment-861938209
# [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#15184](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7c5f217) into [master](https://codecov.io/gh/apache/superset/commit/ab153e66cc6a3ad6a55d9d2b19aef3ef2f9f2625?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ab153e6) will **decrease** coverage by `0.14%`.
> The diff coverage is `100.00%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/15184/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #15184 +/- ##
==========================================
- Coverage 77.14% 77.00% -0.15%
==========================================
Files 973 973
Lines 50473 50496 +23
Branches 6183 6183
==========================================
- Hits 38938 38882 -56
- Misses 11329 11408 +79
Partials 206 206
```
| Flag | Coverage Δ | |
|---|---|---|
| hive | `?` | |
| mysql | `81.69% <100.00%> (+<0.01%)` | :arrow_up: |
| postgres | `81.71% <100.00%> (+0.01%)` | :arrow_up: |
| python | `81.79% <100.00%> (-0.29%)` | :arrow_down: |
| sqlite | `81.34% <100.00%> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [superset/views/chart/views.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY2hhcnQvdmlld3MucHk=) | `88.63% <ø> (ø)` | |
| [superset/views/core.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY29yZS5weQ==) | `75.54% <ø> (-0.04%)` | :arrow_down: |
| [superset/connectors/connector\_registry.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9jb25uZWN0b3JfcmVnaXN0cnkucHk=) | `83.33% <100.00%> (+4.64%)` | :arrow_up: |
| [superset/db\_engines/hive.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lcy9oaXZlLnB5) | `0.00% <0.00%> (-82.15%)` | :arrow_down: |
| [superset/db\_engine\_specs/hive.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2hpdmUucHk=) | `69.20% <0.00%> (-17.21%)` | :arrow_down: |
| [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `81.03% <0.00%> (-1.73%)` | :arrow_down: |
| [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `83.36% <0.00%> (-1.06%)` | :arrow_down: |
| [superset/db\_engine\_specs/base.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2Jhc2UucHk=) | `87.97% <0.00%> (-0.41%)` | :arrow_down: |
| [superset/connectors/sqla/models.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9zcWxhL21vZGVscy5weQ==) | `88.22% <0.00%> (-0.24%)` | :arrow_down: |
| [superset/utils/core.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdXRpbHMvY29yZS5weQ==) | `88.93% <0.00%> (-0.13%)` | :arrow_down: |
| ... and [2 more](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ab153e6...7c5f217](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] dpgaspar commented on a change in pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
dpgaspar commented on a change in pull request #15184:
URL: https://github.com/apache/superset/pull/15184#discussion_r656875243
##########
File path: superset/connectors/connector_registry.py
##########
@@ -73,6 +74,47 @@ def get_all_datasources(cls, session: Session) -> List["BaseDatasource"]:
datasources.extend(qry.all())
return datasources
+ @classmethod
+ def get_user_datasources(cls, session: Session) -> List["BaseDatasource"]:
+ from superset import security_manager
+
+ # collect datasources which the user has explicit permissions to
+ user_perms = security_manager.user_view_menu_names("datasource_access")
+ schema_perms = security_manager.user_view_menu_names("schema_access")
+ user_datasources = []
+ for datasource_class in ConnectorRegistry.sources.values():
+ user_datasources.extend(
+ session.query(datasource_class)
+ .filter(
+ or_(
+ datasource_class.perm.in_(user_perms),
+ datasource_class.schema_perm.in_(schema_perms),
+ )
+ )
+ .all()
+ )
+
+ # get all datasources and organize by database -> schema -> datasource
+ all_datasources = cls.get_all_datasources(session)
+ hierarchy: Dict[
+ "Database", Dict[Optional[str], Set["BaseDatasource"]]
+ ] = defaultdict(lambda: defaultdict(set))
+ for datasource in all_datasources:
+ hierarchy[datasource.database][datasource.schema].add(datasource)
+
+ # add datasources with implicit permission (eg, database access)
+ for database, schemas_tables in hierarchy.items():
+ has_database_access = security_manager.can_access_database(database)
+ for schema, datasources in schemas_tables.items():
+ schema_perm = security_manager.get_schema_perm(database, schema)
+ if has_database_access or (
+ schema_perm
+ and security_manager.can_access("schema_access", schema_perm)
+ ):
+ user_datasources.extend(datasources)
Review comment:
`can_access_database` handles it
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov[bot] edited a comment on pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #15184:
URL: https://github.com/apache/superset/pull/15184#issuecomment-861938209
# [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#15184](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7c6a057) into [master](https://codecov.io/gh/apache/superset/commit/ab153e66cc6a3ad6a55d9d2b19aef3ef2f9f2625?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ab153e6) will **increase** coverage by `0.07%`.
> The diff coverage is `53.19%`.
> :exclamation: Current head 7c6a057 differs from pull request most recent head 22ed433. Consider uploading reports for the commit 22ed433 to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/15184/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #15184 +/- ##
==========================================
+ Coverage 77.14% 77.21% +0.07%
==========================================
Files 973 973
Lines 50473 50496 +23
Branches 6183 6180 -3
==========================================
+ Hits 38938 38992 +54
+ Misses 11329 11298 -31
Partials 206 206
```
| Flag | Coverage Δ | |
|---|---|---|
| hive | `81.42% <92.59%> (+0.01%)` | :arrow_up: |
| mysql | `81.69% <92.59%> (+0.01%)` | :arrow_up: |
| postgres | `?` | |
| presto | `81.41% <92.59%> (?)` | |
| python | `82.20% <92.59%> (+0.12%)` | :arrow_up: |
| sqlite | `81.34% <92.59%> (+0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [superset-frontend/src/SqlLab/reducers/sqlLab.js](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9yZWR1Y2Vycy9zcWxMYWIuanM=) | `34.95% <0.00%> (+0.83%)` | :arrow_up: |
| [superset-frontend/src/components/Select/Select.tsx](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L1NlbGVjdC50c3g=) | `0.00% <0.00%> (ø)` | |
| [superset-frontend/src/components/Select/utils.ts](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L3V0aWxzLnRz) | `66.66% <ø> (ø)` | |
| [superset-frontend/src/components/index.ts](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvaW5kZXgudHM=) | `0.00% <0.00%> (ø)` | |
| [superset/views/chart/views.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY2hhcnQvdmlld3MucHk=) | `88.63% <ø> (ø)` | |
| [superset/views/sql\_lab.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3Mvc3FsX2xhYi5weQ==) | `60.68% <ø> (ø)` | |
| [superset/views/core.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY29yZS5weQ==) | `75.54% <71.42%> (-0.04%)` | :arrow_down: |
| [superset/connectors/connector\_registry.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9jb25uZWN0b3JfcmVnaXN0cnkucHk=) | `83.95% <100.00%> (+5.26%)` | :arrow_up: |
| [superset/sql\_validators/postgres.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc3FsX3ZhbGlkYXRvcnMvcG9zdGdyZXMucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
| [superset/db\_engine\_specs/postgres.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3Bvc3RncmVzLnB5) | `96.00% <0.00%> (-1.00%)` | :arrow_down: |
| ... and [4 more](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ab153e6...22ed433](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov[bot] edited a comment on pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #15184:
URL: https://github.com/apache/superset/pull/15184#issuecomment-861938209
# [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#15184](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7c5f217) into [master](https://codecov.io/gh/apache/superset/commit/ab153e66cc6a3ad6a55d9d2b19aef3ef2f9f2625?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ab153e6) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/15184/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #15184 +/- ##
=======================================
Coverage 77.14% 77.15%
=======================================
Files 973 973
Lines 50473 50496 +23
Branches 6183 6183
=======================================
+ Hits 38938 38959 +21
- Misses 11329 11331 +2
Partials 206 206
```
| Flag | Coverage Δ | |
|---|---|---|
| hive | `81.42% <100.00%> (+<0.01%)` | :arrow_up: |
| mysql | `81.69% <100.00%> (+<0.01%)` | :arrow_up: |
| postgres | `81.71% <100.00%> (+<0.01%)` | :arrow_up: |
| python | `82.08% <100.00%> (+<0.01%)` | :arrow_up: |
| sqlite | `81.34% <100.00%> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [superset/views/chart/views.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY2hhcnQvdmlld3MucHk=) | `88.63% <ø> (ø)` | |
| [superset/views/core.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY29yZS5weQ==) | `75.54% <ø> (-0.04%)` | :arrow_down: |
| [superset/connectors/connector\_registry.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9jb25uZWN0b3JfcmVnaXN0cnkucHk=) | `83.33% <100.00%> (+4.64%)` | :arrow_up: |
| [superset/views/sql\_lab.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3Mvc3FsX2xhYi5weQ==) | `60.68% <0.00%> (ø)` | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ab153e6...7c5f217](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov[bot] edited a comment on pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #15184:
URL: https://github.com/apache/superset/pull/15184#issuecomment-861938209
# [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#15184](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7c5f217) into [master](https://codecov.io/gh/apache/superset/commit/ab153e66cc6a3ad6a55d9d2b19aef3ef2f9f2625?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ab153e6) will **increase** coverage by `0.08%`.
> The diff coverage is `100.00%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/15184/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #15184 +/- ##
==========================================
+ Coverage 77.14% 77.23% +0.08%
==========================================
Files 973 973
Lines 50473 50496 +23
Branches 6183 6183
==========================================
+ Hits 38938 39000 +62
+ Misses 11329 11290 -39
Partials 206 206
```
| Flag | Coverage Δ | |
|---|---|---|
| hive | `81.42% <100.00%> (+<0.01%)` | :arrow_up: |
| mysql | `81.69% <100.00%> (+<0.01%)` | :arrow_up: |
| postgres | `81.71% <100.00%> (+<0.01%)` | :arrow_up: |
| presto | `81.41% <100.00%> (?)` | |
| python | `82.24% <100.00%> (+0.16%)` | :arrow_up: |
| sqlite | `81.34% <100.00%> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [superset/views/chart/views.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY2hhcnQvdmlld3MucHk=) | `88.63% <ø> (ø)` | |
| [superset/views/core.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY29yZS5weQ==) | `75.54% <ø> (-0.04%)` | :arrow_down: |
| [superset/connectors/connector\_registry.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9jb25uZWN0b3JfcmVnaXN0cnkucHk=) | `83.33% <100.00%> (+4.64%)` | :arrow_up: |
| [superset/views/sql\_lab.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3Mvc3FsX2xhYi5weQ==) | `60.68% <0.00%> (ø)` | |
| [superset/models/core.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvbW9kZWxzL2NvcmUucHk=) | `90.02% <0.00%> (+0.26%)` | :arrow_up: |
| [superset/connectors/sqla/models.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9zcWxhL21vZGVscy5weQ==) | `89.87% <0.00%> (+1.41%)` | :arrow_up: |
| [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `90.31% <0.00%> (+5.89%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ab153e6...7c5f217](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov[bot] edited a comment on pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #15184:
URL: https://github.com/apache/superset/pull/15184#issuecomment-861938209
# [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#15184](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (31e46a6) into [master](https://codecov.io/gh/apache/superset/commit/cc2b4fe3f471814fb75c1c8bce97867c96caaec7?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (cc2b4fe) will **decrease** coverage by `0.15%`.
> The diff coverage is `100.00%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/15184/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #15184 +/- ##
==========================================
- Coverage 77.54% 77.38% -0.16%
==========================================
Files 967 967
Lines 49752 49809 +57
Branches 6351 6351
==========================================
- Hits 38578 38544 -34
- Misses 10972 11063 +91
Partials 202 202
```
| Flag | Coverage Δ | |
|---|---|---|
| hive | `?` | |
| mysql | `81.70% <100.00%> (-0.02%)` | :arrow_down: |
| postgres | `81.72% <100.00%> (-0.02%)` | :arrow_down: |
| python | `81.80% <100.00%> (-0.31%)` | :arrow_down: |
| sqlite | `81.35% <100.00%> (-0.01%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [superset/views/chart/views.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY2hhcnQvdmlld3MucHk=) | `88.63% <ø> (ø)` | |
| [superset/views/core.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY29yZS5weQ==) | `75.55% <ø> (ø)` | |
| [superset/connectors/connector\_registry.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9jb25uZWN0b3JfcmVnaXN0cnkucHk=) | `90.14% <100.00%> (+3.86%)` | :arrow_up: |
| [superset/db\_engines/hive.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lcy9oaXZlLnB5) | `0.00% <0.00%> (-82.15%)` | :arrow_down: |
| [superset/db\_engine\_specs/hive.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2hpdmUucHk=) | `69.20% <0.00%> (-18.20%)` | :arrow_down: |
| [superset/exceptions.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZXhjZXB0aW9ucy5weQ==) | `93.50% <0.00%> (-5.20%)` | :arrow_down: |
| [superset/databases/commands/create.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL2NyZWF0ZS5weQ==) | `88.23% <0.00%> (-3.93%)` | :arrow_down: |
| [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `81.03% <0.00%> (-1.73%)` | :arrow_down: |
| [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `83.36% <0.00%> (-1.06%)` | :arrow_down: |
| [superset/queries/saved\_queries/api.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvcXVlcmllcy9zYXZlZF9xdWVyaWVzL2FwaS5weQ==) | `95.23% <0.00%> (-0.81%)` | :arrow_down: |
| ... and [11 more](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [cc2b4fe...31e46a6](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] john-bodley commented on a change in pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
john-bodley commented on a change in pull request #15184:
URL: https://github.com/apache/superset/pull/15184#discussion_r660129674
##########
File path: superset/connectors/connector_registry.py
##########
@@ -99,6 +100,41 @@ def get_datasource_by_id( # pylint: disable=too-many-arguments
pass
raise NoResultFound(_("Datasource id not found: %(id)s", id=datasource_id))
+ @classmethod
+ def get_user_datasources(cls, session: Session) -> List["BaseDatasource"]:
+ from superset import security_manager
+
+ # collect datasources which the user has explicit permissions to
+ user_perms = security_manager.user_view_menu_names("datasource_access")
+ schema_perms = security_manager.user_view_menu_names("schema_access")
+ user_datasources = set()
+ for datasource_class in ConnectorRegistry.sources.values():
+ user_datasources.update(
+ session.query(datasource_class)
Review comment:
@dpgaspar that's correct. We actually don't use any of the FAB logic and thus we completely bypass the `securiy_manager.user_view_menu_names` and reliance of the `datasource_class.perm` and `datasource_class.schema_perm` database columns.
##########
File path: superset/connectors/connector_registry.py
##########
@@ -99,6 +100,41 @@ def get_datasource_by_id( # pylint: disable=too-many-arguments
pass
raise NoResultFound(_("Datasource id not found: %(id)s", id=datasource_id))
+ @classmethod
+ def get_user_datasources(cls, session: Session) -> List["BaseDatasource"]:
+ from superset import security_manager
+
+ # collect datasources which the user has explicit permissions to
+ user_perms = security_manager.user_view_menu_names("datasource_access")
+ schema_perms = security_manager.user_view_menu_names("schema_access")
+ user_datasources = set()
+ for datasource_class in ConnectorRegistry.sources.values():
+ user_datasources.update(
+ session.query(datasource_class)
Review comment:
@betodealmeida if the `get_datasources_accessible_by_user` method isn't ideal, then I think the alternatively would be to move the `get_user_datasources` method to the security manager so deployments can overwrite the logic if necessary.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov[bot] edited a comment on pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #15184:
URL: https://github.com/apache/superset/pull/15184#issuecomment-861938209
# [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#15184](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7c5f217) into [master](https://codecov.io/gh/apache/superset/commit/ab153e66cc6a3ad6a55d9d2b19aef3ef2f9f2625?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ab153e6) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/15184/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #15184 +/- ##
=======================================
Coverage 77.14% 77.15%
=======================================
Files 973 973
Lines 50473 50496 +23
Branches 6183 6183
=======================================
+ Hits 38938 38959 +21
- Misses 11329 11331 +2
Partials 206 206
```
| Flag | Coverage Δ | |
|---|---|---|
| hive | `81.42% <100.00%> (+<0.01%)` | :arrow_up: |
| mysql | `81.69% <100.00%> (+<0.01%)` | :arrow_up: |
| postgres | `81.71% <100.00%> (+<0.01%)` | :arrow_up: |
| python | `82.08% <100.00%> (+<0.01%)` | :arrow_up: |
| sqlite | `81.34% <100.00%> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [superset/views/chart/views.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY2hhcnQvdmlld3MucHk=) | `88.63% <ø> (ø)` | |
| [superset/views/core.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY29yZS5weQ==) | `75.54% <ø> (-0.04%)` | :arrow_down: |
| [superset/connectors/connector\_registry.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9jb25uZWN0b3JfcmVnaXN0cnkucHk=) | `83.33% <100.00%> (+4.64%)` | :arrow_up: |
| [superset/views/sql\_lab.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3Mvc3FsX2xhYi5weQ==) | `60.68% <0.00%> (ø)` | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ab153e6...7c5f217](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] dpgaspar commented on a change in pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
dpgaspar commented on a change in pull request #15184:
URL: https://github.com/apache/superset/pull/15184#discussion_r657792667
##########
File path: superset/connectors/connector_registry.py
##########
@@ -99,6 +100,41 @@ def get_datasource_by_id( # pylint: disable=too-many-arguments
pass
raise NoResultFound(_("Datasource id not found: %(id)s", id=datasource_id))
+ @classmethod
+ def get_user_datasources(cls, session: Session) -> List["BaseDatasource"]:
+ from superset import security_manager
+
+ # collect datasources which the user has explicit permissions to
+ user_perms = security_manager.user_view_menu_names("datasource_access")
+ schema_perms = security_manager.user_view_menu_names("schema_access")
+ user_datasources = set()
+ for datasource_class in ConnectorRegistry.sources.values():
+ user_datasources.update(
+ session.query(datasource_class)
Review comment:
@betodealmeida @john-bodley I think that the question here is that AirBnb totally overrides the DB permissions, they do that by overriding the security manager, their permission "backend" is something totally different. So that's possible if all permission checks are done on the security manager.
Makes me think how can that work on the REST API defined filters
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov[bot] edited a comment on pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #15184:
URL: https://github.com/apache/superset/pull/15184#issuecomment-861938209
# [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#15184](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7c6a057) into [master](https://codecov.io/gh/apache/superset/commit/ab153e66cc6a3ad6a55d9d2b19aef3ef2f9f2625?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ab153e6) will **decrease** coverage by `0.00%`.
> The diff coverage is `53.19%`.
> :exclamation: Current head 7c6a057 differs from pull request most recent head 8330c35. Consider uploading reports for the commit 8330c35 to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/15184/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #15184 +/- ##
==========================================
- Coverage 77.14% 77.13% -0.01%
==========================================
Files 973 973
Lines 50473 50496 +23
Branches 6183 6180 -3
==========================================
+ Hits 38938 38951 +13
- Misses 11329 11339 +10
Partials 206 206
```
| Flag | Coverage Δ | |
|---|---|---|
| hive | `81.42% <92.59%> (+0.01%)` | :arrow_up: |
| mysql | `81.69% <92.59%> (+0.01%)` | :arrow_up: |
| postgres | `?` | |
| python | `82.04% <92.59%> (-0.04%)` | :arrow_down: |
| sqlite | `81.34% <92.59%> (+0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [superset-frontend/src/SqlLab/reducers/sqlLab.js](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9yZWR1Y2Vycy9zcWxMYWIuanM=) | `34.95% <0.00%> (+0.83%)` | :arrow_up: |
| [superset-frontend/src/components/Select/Select.tsx](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L1NlbGVjdC50c3g=) | `0.00% <0.00%> (ø)` | |
| [superset-frontend/src/components/Select/utils.ts](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L3V0aWxzLnRz) | `66.66% <ø> (ø)` | |
| [superset-frontend/src/components/index.ts](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvaW5kZXgudHM=) | `0.00% <0.00%> (ø)` | |
| [superset/views/chart/views.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY2hhcnQvdmlld3MucHk=) | `88.63% <ø> (ø)` | |
| [superset/views/sql\_lab.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3Mvc3FsX2xhYi5weQ==) | `60.68% <ø> (ø)` | |
| [superset/views/core.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY29yZS5weQ==) | `75.54% <71.42%> (-0.04%)` | :arrow_down: |
| [superset/connectors/connector\_registry.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9jb25uZWN0b3JfcmVnaXN0cnkucHk=) | `83.95% <100.00%> (+5.26%)` | :arrow_up: |
| [superset/sql\_validators/postgres.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc3FsX3ZhbGlkYXRvcnMvcG9zdGdyZXMucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
| [superset/db\_engine\_specs/postgres.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3Bvc3RncmVzLnB5) | `96.00% <0.00%> (-1.00%)` | :arrow_down: |
| ... and [1 more](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ab153e6...8330c35](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] john-bodley commented on a change in pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
john-bodley commented on a change in pull request #15184:
URL: https://github.com/apache/superset/pull/15184#discussion_r657430908
##########
File path: superset/connectors/connector_registry.py
##########
@@ -99,6 +100,41 @@ def get_datasource_by_id( # pylint: disable=too-many-arguments
pass
raise NoResultFound(_("Datasource id not found: %(id)s", id=datasource_id))
+ @classmethod
+ def get_user_datasources(cls, session: Session) -> List["BaseDatasource"]:
+ from superset import security_manager
+
+ # collect datasources which the user has explicit permissions to
+ user_perms = security_manager.user_view_menu_names("datasource_access")
+ schema_perms = security_manager.user_view_menu_names("schema_access")
+ user_datasources = set()
+ for datasource_class in ConnectorRegistry.sources.values():
+ user_datasources.update(
+ session.query(datasource_class)
Review comment:
@betodealmeida I believe this logic, i.e., relying on the fragile `perm` and `schema_perm` columns in the database, breaks if people are using a custom security manager. Should we be calling [get_datasources_accessible_by_user](https://github.com/apache/superset/blob/a06a2f30af02820189450b2264fa6bb734507ed8/superset/security/manager.py#L508) instead?
Note I sense currently Superset doesn't do a great job of differentiating between metadata and data access. The `get_datasources_accessible_by_user` is somewhat of a misnomer as it is merely used for metadata access (for an awareness perspective).
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov[bot] edited a comment on pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #15184:
URL: https://github.com/apache/superset/pull/15184#issuecomment-861938209
# [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#15184](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7c5f217) into [master](https://codecov.io/gh/apache/superset/commit/ab153e66cc6a3ad6a55d9d2b19aef3ef2f9f2625?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ab153e6) will **decrease** coverage by `0.14%`.
> The diff coverage is `100.00%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/15184/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #15184 +/- ##
==========================================
- Coverage 77.14% 77.00% -0.15%
==========================================
Files 973 973
Lines 50473 50496 +23
Branches 6183 6183
==========================================
- Hits 38938 38882 -56
- Misses 11329 11408 +79
Partials 206 206
```
| Flag | Coverage Δ | |
|---|---|---|
| hive | `?` | |
| mysql | `81.69% <100.00%> (+<0.01%)` | :arrow_up: |
| postgres | `81.71% <100.00%> (+<0.01%)` | :arrow_up: |
| python | `81.79% <100.00%> (-0.29%)` | :arrow_down: |
| sqlite | `81.34% <100.00%> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [superset/views/chart/views.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY2hhcnQvdmlld3MucHk=) | `88.63% <ø> (ø)` | |
| [superset/views/core.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY29yZS5weQ==) | `75.54% <ø> (-0.04%)` | :arrow_down: |
| [superset/connectors/connector\_registry.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9jb25uZWN0b3JfcmVnaXN0cnkucHk=) | `83.33% <100.00%> (+4.64%)` | :arrow_up: |
| [superset/db\_engines/hive.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lcy9oaXZlLnB5) | `0.00% <0.00%> (-82.15%)` | :arrow_down: |
| [superset/db\_engine\_specs/hive.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2hpdmUucHk=) | `69.20% <0.00%> (-17.21%)` | :arrow_down: |
| [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `81.03% <0.00%> (-1.73%)` | :arrow_down: |
| [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `83.36% <0.00%> (-1.06%)` | :arrow_down: |
| [superset/db\_engine\_specs/base.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2Jhc2UucHk=) | `87.97% <0.00%> (-0.41%)` | :arrow_down: |
| [superset/connectors/sqla/models.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9zcWxhL21vZGVscy5weQ==) | `88.22% <0.00%> (-0.24%)` | :arrow_down: |
| [superset/utils/core.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdXRpbHMvY29yZS5weQ==) | `88.93% <0.00%> (-0.13%)` | :arrow_down: |
| ... and [2 more](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ab153e6...7c5f217](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] john-bodley commented on a change in pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
john-bodley commented on a change in pull request #15184:
URL: https://github.com/apache/superset/pull/15184#discussion_r660139948
##########
File path: superset/connectors/connector_registry.py
##########
@@ -99,6 +100,41 @@ def get_datasource_by_id( # pylint: disable=too-many-arguments
pass
raise NoResultFound(_("Datasource id not found: %(id)s", id=datasource_id))
+ @classmethod
+ def get_user_datasources(cls, session: Session) -> List["BaseDatasource"]:
+ from superset import security_manager
+
+ # collect datasources which the user has explicit permissions to
+ user_perms = security_manager.user_view_menu_names("datasource_access")
+ schema_perms = security_manager.user_view_menu_names("schema_access")
+ user_datasources = set()
+ for datasource_class in ConnectorRegistry.sources.values():
+ user_datasources.update(
+ session.query(datasource_class)
Review comment:
@betodealmeida if the `get_datasources_accessible_by_user` method isn't ideal, then I think the alternatively would be to move the `get_user_datasources` method to the security manager so deployments can overwrite the logic if necessary.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] betodealmeida merged pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
betodealmeida merged pull request #15184:
URL: https://github.com/apache/superset/pull/15184
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] betodealmeida commented on a change in pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
betodealmeida commented on a change in pull request #15184:
URL: https://github.com/apache/superset/pull/15184#discussion_r657585115
##########
File path: superset/connectors/connector_registry.py
##########
@@ -99,6 +100,41 @@ def get_datasource_by_id( # pylint: disable=too-many-arguments
pass
raise NoResultFound(_("Datasource id not found: %(id)s", id=datasource_id))
+ @classmethod
+ def get_user_datasources(cls, session: Session) -> List["BaseDatasource"]:
+ from superset import security_manager
+
+ # collect datasources which the user has explicit permissions to
+ user_perms = security_manager.user_view_menu_names("datasource_access")
+ schema_perms = security_manager.user_view_menu_names("schema_access")
+ user_datasources = set()
+ for datasource_class in ConnectorRegistry.sources.values():
+ user_datasources.update(
+ session.query(datasource_class)
Review comment:
@john-bodley, `get_datasources_accessible_by_user` calls `ConnectorRegistry.query_datasources_by_permissions`, which uses the same logic I'm using here.
Since we're getting `user_perms` and `schema_perms` from the security manager (lines 108, 109) doesn't it means this works with custom security managers?
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov[bot] edited a comment on pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #15184:
URL: https://github.com/apache/superset/pull/15184#issuecomment-861938209
# [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#15184](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7c6a057) into [master](https://codecov.io/gh/apache/superset/commit/ab153e66cc6a3ad6a55d9d2b19aef3ef2f9f2625?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ab153e6) will **increase** coverage by `0.07%`.
> The diff coverage is `53.19%`.
> :exclamation: Current head 7c6a057 differs from pull request most recent head 8330c35. Consider uploading reports for the commit 8330c35 to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/15184/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #15184 +/- ##
==========================================
+ Coverage 77.14% 77.21% +0.07%
==========================================
Files 973 973
Lines 50473 50496 +23
Branches 6183 6180 -3
==========================================
+ Hits 38938 38992 +54
+ Misses 11329 11298 -31
Partials 206 206
```
| Flag | Coverage Δ | |
|---|---|---|
| hive | `81.42% <92.59%> (+0.01%)` | :arrow_up: |
| mysql | `81.69% <92.59%> (+0.01%)` | :arrow_up: |
| postgres | `?` | |
| presto | `81.41% <92.59%> (?)` | |
| python | `82.20% <92.59%> (+0.12%)` | :arrow_up: |
| sqlite | `81.34% <92.59%> (+0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [superset-frontend/src/SqlLab/reducers/sqlLab.js](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9yZWR1Y2Vycy9zcWxMYWIuanM=) | `34.95% <0.00%> (+0.83%)` | :arrow_up: |
| [superset-frontend/src/components/Select/Select.tsx](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L1NlbGVjdC50c3g=) | `0.00% <0.00%> (ø)` | |
| [superset-frontend/src/components/Select/utils.ts](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L3V0aWxzLnRz) | `66.66% <ø> (ø)` | |
| [superset-frontend/src/components/index.ts](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvaW5kZXgudHM=) | `0.00% <0.00%> (ø)` | |
| [superset/views/chart/views.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY2hhcnQvdmlld3MucHk=) | `88.63% <ø> (ø)` | |
| [superset/views/sql\_lab.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3Mvc3FsX2xhYi5weQ==) | `60.68% <ø> (ø)` | |
| [superset/views/core.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY29yZS5weQ==) | `75.54% <71.42%> (-0.04%)` | :arrow_down: |
| [superset/connectors/connector\_registry.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9jb25uZWN0b3JfcmVnaXN0cnkucHk=) | `83.95% <100.00%> (+5.26%)` | :arrow_up: |
| [superset/sql\_validators/postgres.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc3FsX3ZhbGlkYXRvcnMvcG9zdGdyZXMucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
| [superset/db\_engine\_specs/postgres.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3Bvc3RncmVzLnB5) | `96.00% <0.00%> (-1.00%)` | :arrow_down: |
| ... and [4 more](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ab153e6...8330c35](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] dpgaspar commented on a change in pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
dpgaspar commented on a change in pull request #15184:
URL: https://github.com/apache/superset/pull/15184#discussion_r652457750
##########
File path: superset/connectors/connector_registry.py
##########
@@ -73,6 +74,47 @@ def get_all_datasources(cls, session: Session) -> List["BaseDatasource"]:
datasources.extend(qry.all())
return datasources
+ @classmethod
+ def get_user_datasources(cls, session: Session) -> List["BaseDatasource"]:
+ from superset import security_manager
+
+ # collect datasources which the user has explicit permissions to
+ user_perms = security_manager.user_view_menu_names("datasource_access")
+ schema_perms = security_manager.user_view_menu_names("schema_access")
+ user_datasources = []
+ for datasource_class in ConnectorRegistry.sources.values():
+ user_datasources.extend(
+ session.query(datasource_class)
+ .filter(
+ or_(
+ datasource_class.perm.in_(user_perms),
+ datasource_class.schema_perm.in_(schema_perms),
+ )
+ )
+ .all()
+ )
+
+ # get all datasources and organize by database -> schema -> datasource
+ all_datasources = cls.get_all_datasources(session)
+ hierarchy: Dict[
+ "Database", Dict[Optional[str], Set["BaseDatasource"]]
+ ] = defaultdict(lambda: defaultdict(set))
+ for datasource in all_datasources:
+ hierarchy[datasource.database][datasource.schema].add(datasource)
+
+ # add datasources with implicit permission (eg, database access)
+ for database, schemas_tables in hierarchy.items():
+ has_database_access = security_manager.can_access_database(database)
+ for schema, datasources in schemas_tables.items():
+ schema_perm = security_manager.get_schema_perm(database, schema)
+ if has_database_access or (
+ schema_perm
+ and security_manager.can_access("schema_access", schema_perm)
+ ):
+ user_datasources.extend(datasources)
Review comment:
oh! this makes me question the validity of the get methods on the MVC and API, they both depend on: https://github.com/apache/superset/blob/master/superset/views/base.py#L581
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov[bot] edited a comment on pull request #15184: fix: datasource payload is incorrect
Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #15184:
URL: https://github.com/apache/superset/pull/15184#issuecomment-861938209
# [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#15184](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7c6a057) into [master](https://codecov.io/gh/apache/superset/commit/ab153e66cc6a3ad6a55d9d2b19aef3ef2f9f2625?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ab153e6) will **increase** coverage by `0.07%`.
> The diff coverage is `53.19%`.
> :exclamation: Current head 7c6a057 differs from pull request most recent head 7c5f217. Consider uploading reports for the commit 7c5f217 to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/15184/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #15184 +/- ##
==========================================
+ Coverage 77.14% 77.21% +0.07%
==========================================
Files 973 973
Lines 50473 50496 +23
Branches 6183 6180 -3
==========================================
+ Hits 38938 38992 +54
+ Misses 11329 11298 -31
Partials 206 206
```
| Flag | Coverage Δ | |
|---|---|---|
| hive | `81.42% <92.59%> (+0.01%)` | :arrow_up: |
| mysql | `81.69% <92.59%> (+0.01%)` | :arrow_up: |
| postgres | `?` | |
| presto | `81.41% <92.59%> (?)` | |
| python | `82.20% <92.59%> (+0.12%)` | :arrow_up: |
| sqlite | `81.34% <92.59%> (+0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [superset-frontend/src/SqlLab/reducers/sqlLab.js](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9yZWR1Y2Vycy9zcWxMYWIuanM=) | `34.95% <0.00%> (+0.83%)` | :arrow_up: |
| [superset-frontend/src/components/Select/Select.tsx](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L1NlbGVjdC50c3g=) | `0.00% <0.00%> (ø)` | |
| [superset-frontend/src/components/Select/utils.ts](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU2VsZWN0L3V0aWxzLnRz) | `66.66% <ø> (ø)` | |
| [superset-frontend/src/components/index.ts](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvaW5kZXgudHM=) | `0.00% <0.00%> (ø)` | |
| [superset/views/chart/views.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY2hhcnQvdmlld3MucHk=) | `88.63% <ø> (ø)` | |
| [superset/views/sql\_lab.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3Mvc3FsX2xhYi5weQ==) | `60.68% <ø> (ø)` | |
| [superset/views/core.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvY29yZS5weQ==) | `75.54% <71.42%> (-0.04%)` | :arrow_down: |
| [superset/connectors/connector\_registry.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9jb25uZWN0b3JfcmVnaXN0cnkucHk=) | `83.95% <100.00%> (+5.26%)` | :arrow_up: |
| [superset/sql\_validators/postgres.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc3FsX3ZhbGlkYXRvcnMvcG9zdGdyZXMucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
| [superset/db\_engine\_specs/postgres.py](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3Bvc3RncmVzLnB5) | `96.00% <0.00%> (-1.00%)` | :arrow_down: |
| ... and [4 more](https://codecov.io/gh/apache/superset/pull/15184/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ab153e6...7c5f217](https://codecov.io/gh/apache/superset/pull/15184?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org