-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
make filters use security manager #5567
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -248,15 +248,11 @@ def get_view_menus(self, permission_name): | |
vm.add(vm_name) | ||
return vm | ||
|
||
def has_all_datasource_access(self): | ||
return ( | ||
self.has_role(['Admin', 'Alpha']) or | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does removing these role checks potentially break things? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are only three usage of the has_all_datasource_access and they are the ones I changed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is the link to where all_datasource_access is granted to Alpha. |
||
self.has_perm('all_datasource_access', 'all_datasource_access')) | ||
|
||
|
||
class DatasourceFilter(SupersetFilter): | ||
def apply(self, query, func): # noqa | ||
if self.has_all_datasource_access(): | ||
if (security_manager.all_datasource_access() or | ||
security_manager.always_list_all_datasources()): | ||
return query | ||
perms = self.get_view_menus('datasource_access') | ||
# TODO(bogdan): add `schema_access` support here | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with your comment that we should defer to the security manager to answer said question, however I’m not sure we need these always_ methods.