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

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

Merged
merged 2 commits into from
Dec 27, 2016

Conversation

willgroves
Copy link
Contributor

This PR replaces #1483 and rebases those changes on the current master.

The get_user_roles should get the role specified for the anon user in the config.py at the key AUTH_ROLE_PUBLIC. Without this fix, the list of tables the anon user can see is limited to the tables visible to the "Public" role.

@xrmx
Copy link
Contributor

xrmx commented Dec 25, 2016

@willgroves thanks, next time please force push on the very same branch instead of opening a new PR.

@@ -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', None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None is default

@@ -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', None)
return [appbuilder.sm.find_role(public_role)] if public_role is not None else []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if public_role else [] should be a bit better, i don't think we want to consider things like an empty string as valid role.

@mistercrunch mistercrunch merged commit ea8e663 into apache:master Dec 27, 2016
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.15.1 labels Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.15.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants