Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues around Database permissions #7009

Merged
merged 1 commit into from Mar 18, 2019

Conversation

mistercrunch
Copy link
Member

No description provided.

@codecov-io
Copy link

codecov-io commented Mar 12, 2019

Codecov Report

Merging #7009 into master will increase coverage by <.01%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7009      +/-   ##
==========================================
+ Coverage   64.46%   64.47%   +<.01%     
==========================================
  Files         421      421              
  Lines       20521    20534      +13     
  Branches     2245     2245              
==========================================
+ Hits        13229    13239      +10     
- Misses       7165     7168       +3     
  Partials      127      127
Impacted Files Coverage Δ
superset/security.py 75.65% <100%> (+0.09%) ⬆️
superset/views/core.py 74.94% <75%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6a4d507...b072dee. Read the comment docs.

permission_name = 'datasource_access'
from superset.models.core import Database
if mapper.class_ == Database:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI , superset init would create the proper database_access (one for each database), but the code here (executed on update/insert) would create/update a datasource_access entry for the database

query = (
query.outerjoin(SQLTable, self.model.datasource_id == SQLTable.c.id)
.outerjoin(models.Database, models.Database.id == SQLTable.c.database_id)
.filter(or_(
models.Database.perm.in_(datasource_perms),
models.Database.perm.in_(database_perms),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be using the wrong entry.

@kristw kristw added the !deprecated-label:bug Deprecated label - Use #bug instead label Mar 13, 2019
Copy link

@graceguo-supercat graceguo-supercat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mistercrunch mistercrunch merged commit f5274a9 into apache:master Mar 18, 2019
@mistercrunch mistercrunch deleted the fix_database_access branch March 18, 2019 05:49
@@ -285,6 +294,7 @@ class DatabaseView(SupersetModelView, DeleteMixin, YamlExportMixin): # noqa
'allow_multi_schema_metadata_fetch': _('Allow Multi Schema Metadata Fetch'),
'backend': _('Backend'),
}
base_filters = [['id', DatabaseFilter, lambda: []]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this broke stuff on our end, users can't see DBs in SQL Lab. I commented it out and permissions work correctly. (edited to say "can't")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean "can't see" (you wrote "can see"). This may require adding all_database_access to alpha

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

betodealmeida added a commit to lyft/incubator-superset that referenced this pull request Apr 10, 2019
xtinec pushed a commit that referenced this pull request Apr 10, 2019
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0 labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels !deprecated-label:bug Deprecated label - Use #bug instead 🚢 0.34.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants