Skip to content
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

This endpoint requires the datasource **, database or `all_datasource_access` permission #33

Closed
brachipa opened this issue Jul 17, 2019 · 11 comments
Labels
bug

Comments

@brachipa
Copy link

@brachipa brachipa commented Jul 17, 2019

When trying to create a chart on data source I get error :
This endpoint requires the datasource , database or all_datasource_access permission

With this stacktrace

Traceback (most recent call last):
  File "/home/superset/superset/views/base.py", line 114, in wraps
    return f(self, *args, **kwargs)
  File "/home/superset/superset/views/core.py", line 1256, in explore_json
    samples=samples,
  File "/home/superset/superset/views/core.py", line 1169, in generate_json
    security_manager.assert_datasource_permission(viz_obj.datasource)
  File "/home/superset/superset/security.py", line 470, in assert_datasource_permission
    self.get_datasource_access_link(datasource),
superset.exceptions.SupersetSecurityException: This endpoint requires the datasource poc-test, database or
            `all_datasource_access` permission

Happens in the latest docker image and also in the version before: 0.29.0rc7

@issue-label-bot issue-label-bot bot added the bug label Jul 17, 2019
@issue-label-bot

This comment has been minimized.

Copy link

@issue-label-bot issue-label-bot bot commented Jul 17, 2019

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.90. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@abhioncbr

This comment has been minimized.

Copy link
Owner

@abhioncbr abhioncbr commented Jul 17, 2019

Can you please share the steps to reproduce the issue?

Also, from the last line of the stack trace, it looks like this happens when you trying to generate a chart using database 'poc-test'. If that is the case, can you please try with default dummy database and see if you are getting an error or not. Thanks.

@brachipa

This comment has been minimized.

Copy link
Author

@brachipa brachipa commented Jul 17, 2019

@abhioncbr same happens for the default DB, I tried birth_names.
Steps:
Just run SUPERSET_ENV=prod docker-compose up --build -d
And then click new chart, and choose the data source (default).

When doing the same by taking the superset repo, and build the docker image, from the latest tag. Everything works well.

@abhioncbr

This comment has been minimized.

Copy link
Owner

@abhioncbr abhioncbr commented Jul 17, 2019

@brachipa I just tried by running a container using Kitematic, and it is working. Let me try with the steps provided by you. In the meanwhile, you can try it a Kitematic way, if you want. Thanks.

@brachipa

This comment has been minimized.

Copy link
Author

@brachipa brachipa commented Jul 17, 2019

@abhioncbr

This comment has been minimized.

Copy link
Owner

@abhioncbr abhioncbr commented Jul 17, 2019

@brachipa

This comment has been minimized.

Copy link
Author

@brachipa brachipa commented Jul 18, 2019

@abhioncbr works when building this:
cd docker-superset/docker-files/ && docker-compose up -d
This takes superset version 0.29.0rc5.
But when switching to latest I fail.

@abhioncbr

This comment has been minimized.

Copy link
Owner

@abhioncbr abhioncbr commented Jul 18, 2019

@brachipa okay, reproduced the issue. It is not a bug; In my opinion, it is a feature in release. Admin role in the latest version doesn't have the permission to access the data and hence charting can not be done on top of it. For accessing the database give permission to the Admin role.

Please add the following permissions in Admin role and than chart will work,

database access on [main].(id:1), database access on [main-other].(id:2), datasource access on [main].energy_usage, datasource access on [main].wb_health_population, datasource access on [main].birth_names, schema access on [main-other].[information_schema], schema access on [main-other].[superset]]

I think this will resolve the issue.

PS: give a star to the repo if you like it.

@brachipa

This comment has been minimized.

Copy link
Author

@brachipa brachipa commented Jul 18, 2019

@abhioncbr

This comment has been minimized.

Copy link
Owner

@abhioncbr abhioncbr commented Jul 18, 2019

security -> List Roles -> edit Admin role -> from drop down add all above mentioned.

Possibly, they added another step for permissions to Admin role, which Superset repo have and mine not.

@abhioncbr abhioncbr closed this Jul 20, 2019
@brachipa

This comment has been minimized.

Copy link
Author

@brachipa brachipa commented Jul 22, 2019

Now, can't open the charts page:

sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1054, "Unknown column 'tables.user_id' in 'field list'") [SQL: 'SELECT tables.created_on AS tables_created_on, tables.changed_on AS tables_changed_on, tables.id AS tables_id, tables.description AS tables_description, tables.default_endpoint AS tables_default_endpoint, tables.is_featured AS tables_is_featured, tables.filter_select_enabled AS tables_filter_select_enabled, tables.offset AS tables_offset, tables.cache_timeout AS tables_cache_timeout, tables.params AS tables_params, tables.perm AS tables_perm, tables.table_name AS tables_table_name, tables.main_dttm_col AS tables_main_dttm_col, tables.database_id AS tables_database_id, tables.fetch_values_predicate AS tables_fetch_values_predicate, tables.user_id AS tables_user_id, tables.schema AS tables_schema, tables.sql AS tables_sql, tables.is_sqllab_view AS tables_is_sqllab_view, tables.template_params AS tables_template_params, tables.created_by_fk AS tables_created_by_fk, tables.changed_by_fk AS tables_changed_by_fk \nFROM tables \nWHERE tables.id = %s \n LIMIT %s'] [parameters: (3, 1)] (Background on this error at: http://sqlalche.me/e/e3q8)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.