-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filter table list based on the user permissions. (#1769)
* Filter table list based on the user permissions. * Fix tests
- Loading branch information
Showing
3 changed files
with
31 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
|
||
from flask_appbuilder.security.sqla import models as ab_models | ||
|
||
from superset import app, cli, db, models, appbuilder, sm | ||
from superset import app, cli, db, models, appbuilder, security, sm | ||
from superset.security import sync_role_definitions | ||
|
||
os.environ['SUPERSET_CONFIG'] = 'tests.superset_test_config' | ||
|
@@ -43,6 +43,11 @@ def __init__(self, *args, **kwargs): | |
gamma_sqllab = sm.add_role("gamma_sqllab") | ||
for perm in sm.find_role('Gamma').permissions: | ||
sm.add_permission_role(gamma_sqllab, perm) | ||
db_perm = self.get_main_database(sm.get_session).perm | ||
security.merge_perm(sm, 'database_access', db_perm) | ||
db_pvm = sm.find_permission_view_menu( | ||
view_menu_name=db_perm, permission_name='database_access') | ||
gamma_sqllab.permissions.append(db_pvm) | ||
for perm in sm.find_role('sql_lab').permissions: | ||
sm.add_permission_role(gamma_sqllab, perm) | ||
|
||
|
@@ -73,6 +78,7 @@ def __init__(self, *args, **kwargs): | |
'alpha', 'alpha', 'user', '[email protected]', | ||
appbuilder.sm.find_role('Alpha'), | ||
password='general') | ||
sm.get_session.commit() | ||
|
||
# create druid cluster and druid datasources | ||
session = db.session | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters