Skip to content

Conversation

@dflionis
Copy link
Contributor

@dflionis dflionis commented May 30, 2019

This is an attempt to resurrect #6356 which had been approved by Maxime but needs to be rebased and may have been abandoned. I'm not sure if this replicates that functionality as I had to make some changes--but I'm happy to attempt to push this along as feedback comes in.

@dflionis dflionis force-pushed the filter-databases-based-on-roles branch from 461a8b2 to 53193e3 Compare May 30, 2019 01:18
@dflionis dflionis force-pushed the filter-databases-based-on-roles branch from 53193e3 to c79a1cf Compare May 31, 2019 00:17
@dflionis dflionis changed the title [WIP] Add Filter on DatabaseView that filters DBs Based on Role Access Add Filter on DatabaseView that filters DBs Based on Role Access May 31, 2019
'all_datasource_access', 'all_datasource_access')

def all_database_access(self):
return self.can_access('all_database_access', 'all_database_access')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the original PR, this was sending a user keyword argument. However, can_access() does not currently accept a keyword arg so I removed it

return self.can_access(
'all_datasource_access', 'all_datasource_access')

def all_database_access(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A different contributor came along and added some tests to this module, but since the tests were failing and it was after Maxime's approval, I did not attempt to port them over. Happy to try to write tests if there is demand for adding them.

'all_database_access', 'all_database_access') or
self.can_access('database_access', database.perm)
)
return self.can_access('database_access', database.perm)
Copy link
Member

Choose a reason for hiding this comment

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

Can we make this:
return self.all_database_access() or self.can_access('database_access', database.perm) ?

Copy link
Member

Choose a reason for hiding this comment

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

Wondering if we should also checkout for all_datasource_access (which is redundant with all_database_access) here for backwards compatibility reasons. Say if someone setup a local role Users with access to all data that has all_datasource_access, I feel like they should see all databases when opening SQL Lab.

Copy link
Member

Choose a reason for hiding this comment

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

BTW I feel like I wrote/merged this same PR a few months back but got reverted because of a perm issue (Alpha couldn't see the database list in SQL Lab).

PR that got reverted:
#7009

Related fix:
#7271

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for checking this out--the PR has been updated. Regarding the last comment about a similar PR having gone in and gotten reverted, please let me know if that changes anything about how I should structure this PR and I would be happy to make the changes.

@codecov-io
Copy link

codecov-io commented Jun 5, 2019

Codecov Report

Merging #7618 into master will increase coverage by <.01%.
The diff coverage is 80%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7618      +/-   ##
==========================================
+ Coverage   65.57%   65.58%   +<.01%     
==========================================
  Files         435      435              
  Lines       21744    21753       +9     
  Branches     2393     2393              
==========================================
+ Hits        14259    14266       +7     
- Misses       7364     7366       +2     
  Partials      121      121
Impacted Files Coverage Δ
superset/security.py 73.36% <100%> (+0.23%) ⬆️
superset/views/core.py 72.87% <71.42%> (-0.01%) ⬇️

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 f99ae1a...61d4032. Read the comment docs.

@dflionis dflionis force-pushed the filter-databases-based-on-roles branch from 4d9c89b to 61d4032 Compare June 5, 2019 00:57
@mistercrunch mistercrunch merged commit 5470d10 into apache:master Jun 5, 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 First shipped in 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 size/S 🚢 0.34.0 First shipped in 0.34.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants