dpgaspar commented on a change in pull request #8189: [WIP] Show databases for
users with schema access in sqllab
URL:
https://github.com/apache/incubator-superset/pull/8189#discussion_r321977448
##########
File path: tests/security_tests.py
##########
@@ -28,8 +30,46 @@ def get_perm_tuples(role_name):
return perm_set
+SCHEMA_ACCESS_ROLE = "schema_access_role"
+
+
class RolePermissionTests(SupersetTestCase):
- """Testing export import functionality for dashboards"""
+ """Testing export role permissions."""
+
+ def test_sqllab_gamma_user_access_to_sqllab(self):
+ session = db.session
+ security_manager.add_role(SCHEMA_ACCESS_ROLE)
+ session.commit()
+
+ example_db =
session.query(Database).filter_by(database_name='examples').one()
+ example_db.expose_in_sqllab = True
+ session.commit()
+
+ ds =
db.session.query(SqlaTable).filter_by(table_name="wb_health_population").first()
+ ds.schema = "temp_schema"
+ security_manager.add_permission_view_menu("schema_access",
ds.schema_perm)
+ schema_perm_view = security_manager.find_permission_view_menu(
+ "schema_access", ds.schema_perm
+ )
+ security_manager.add_permission_role(
+ security_manager.find_role(SCHEMA_ACCESS_ROLE), schema_perm_view
+ )
+ gamma_user = security_manager.find_user(username="gamma")
+ gamma_user.roles.append(security_manager.find_role(SCHEMA_ACCESS_ROLE))
+ session.commit()
+
+ GET_SQL_DBS_REQUEST =
"databaseasync/api/read?_flt_0_expose_in_sqllab=1&" \
Review comment:
Endpoint should be:
`/api/v1/database/?q=(keys:!(none),filters:!((col:expose_in_sqllab,opr:eq,value:!t)),order_columns:database_name,order_direction:asc,page:0,page_size:-1)`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]