-
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
chore(security): Renaming access methods #10031
chore(security): Renaming access methods #10031
Conversation
6a89904
to
315f39e
Compare
13d7f84
to
59d6fed
Compare
Codecov Report
@@ Coverage Diff @@
## master #10031 +/- ##
=======================================
Coverage 68.88% 68.88%
=======================================
Files 584 584
Lines 31058 31054 -4
Branches 3180 3180
=======================================
- Hits 21393 21392 -1
+ Misses 9555 9552 -3
Partials 110 110
Continue to review full report at Codecov.
|
3f813ca
to
44ff419
Compare
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.
Consistent naming FTW 👍 LGTM, but if we decide to go down the aliasing with deprecation road I think that'd be really friendly to admins of Superset installations.
@villebro I agree with your comment however we run into a name conflict issue per #10030 (comment). Note at Airbnb we have a unit test which checks for possible changes in the base security manager (as well as import inspect
from typing import inspect
from superset.security import SupersetSecurityManager
import MySecurityManager
def test_sm_parity_public_methods() -> None:
def _methods(klass: SupersetSecurityManager) -> Set[str]:
return {
name
for name, _ in inspect.getmembers(klass, predicate=inspect.isfunction)
if not name.startswith("_")
}
assert _methods(MySecurityManager) == _methods(SupersetSecurityManager) Maybe it's worthwhile adding this to the documentation. |
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.
LGTM (in reference to #10030 )
44ff419
to
5ab9579
Compare
58fed86
to
f66990e
Compare
f66990e
to
02dac5e
Compare
02dac5e
to
1c0bb1d
Compare
This reverts commit 9532bff.
Co-authored-by: John Bodley <john.bodley@airbnb.com> (cherry picked from commit 9532bff)
Co-authored-by: John Bodley <john.bodley@airbnb.com>
SUMMARY
This PR addresses the following:
Ensures consistent naming of the "access" methods for the security manager, i.e., previously we had methods named
can_access_all_queries
andall_datasource_access
(note the singular "datasource"). The former is prefer as the return type is implied. Note I believe the later existed for possible consistency with the underlying FAB per names, however this isn't a requirement per thecan_access_all_queries
example. The renaming is as follows:can_access_datasource
->can_access_table
(more explicit and resolves naming conflict with thedatasource_access
rename)all_datasource_access
->can_access_all_datasources
(plural)all_database_access
->can_access_all_databases
(plural)database_access
->can_access_database
schema_access
->can_access_schema
datasource_access
->can_access_datasource
The
can_access_table
(previously namedcan_access_datasource
) method signature has changed. The optional schema argument no longer exists as it is defined within theTable
object.Removes unnecessary checks, i.e., previous logic was in the form,
however the
database_access
method (now namedcan_access_database
) first checks whether the user can access all datasources (per here) and thus the second check is irrelevant.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
CI.
ADDITIONAL INFORMATION