Skip to content

Commit

Permalink
read anon user role from config, remove reference to public role (#1878)
Browse files Browse the repository at this point in the history
* read anon user role from configuration, add anon user role as 'Public' to testing configuration

* apply suggestions
  • Loading branch information
willgroves authored and mistercrunch committed Dec 27, 2016
1 parent 3e6f90c commit ea8e663
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion superset/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ def check_ownership(obj, raise_if_false=True):

def get_user_roles():
if g.user.is_anonymous():
return [appbuilder.sm.find_role('Public')]
public_role = config.get('AUTH_ROLE_PUBLIC')
return [appbuilder.sm.find_role(public_role)] if public_role else []
return g.user.roles


Expand Down
2 changes: 1 addition & 1 deletion tests/superset_test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
SECRET_KEY = 'thisismyscretkey'
WTF_CSRF_ENABLED = False
PUBLIC_ROLE_LIKE_GAMMA = True

AUTH_ROLE_PUBLIC = 'Public'

class CeleryConfig(object):
BROKER_URL = 'sqla+sqlite:///' + SQL_CELERY_DB_FILE_PATH
Expand Down

0 comments on commit ea8e663

Please sign in to comment.