You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "betodealmeida (via GitHub)" <gi...@apache.org> on 2024/07/12 23:43:17 UTC
[PR] fix: catalog permission check [superset]
betodealmeida opened a new pull request, #29581:
URL: https://github.com/apache/superset/pull/29581
<!---
Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
Example:
fix(dashboard): load charts correctly
-->
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
Fix a couple issues with the catalog permission check when adding a dataset:
- When listing catalogs there is an off-by-one error when including catalogs in which the user has schema access. For example, if a database `db` has 2 catalogs, `A` and `B`, if the user has access to the schema `db.A.schema1` we should show catalog `A` in the response from `get_catalogs_accessible_by_user`. The off by one error makes the method return `schema1` instead, which is then discarded because it was not in `{A, B}`.
- When fetching tables, if a catalog is not specified (either because "Allow changing catalogs" is disabled, or because the DB doesn't support catalogs) then the schema permission still needs to be built with `catalog or default_catalog`, since we need the catalog name in the built schema permission even if "Allow changing catalogs" is disabled, otherwise the schema check will fail.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
WIP
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] 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.
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
Re: [PR] fix: catalog permission check [superset]
Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida merged PR #29581:
URL: https://github.com/apache/superset/pull/29581
--
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
Re: [PR] fix: catalog permission check [superset]
Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida commented on code in PR #29581:
URL: https://github.com/apache/superset/pull/29581#discussion_r1676565435
##########
superset/security/manager.py:
##########
@@ -860,7 +860,7 @@ def get_catalogs_accessible_by_user(
if len(parts) == 2 and default_catalog:
accessible_catalogs.add(default_catalog)
elif len(parts) == 3:
- accessible_catalogs.add(parts[2])
+ accessible_catalogs.add(parts[1])
Review Comment:
> There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
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