read anon user role from config, remove reference to public role (#1878)

* read anon user role from configuration, add anon user role as 'Public' to testing configuration

* apply suggestions
This commit is contained in:
willgroves 2016-12-27 17:30:01 -05:00 committed by Maxime Beauchemin
parent 3e6f90cf72
commit ea8e6634d6
2 changed files with 3 additions and 2 deletions

View File

@ -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

View File

@ -20,7 +20,7 @@ CSRF_ENABLED = False
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