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

fix: check embedded feature flag in request loader #18628

Merged
merged 3 commits into from
Feb 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions superset/security/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,17 @@ class SupersetSecurityManager( # pylint: disable=too-many-public-methods
guest_user_cls = GuestUser

def create_login_manager(self, app: Flask) -> LoginManager:
lm = super().create_login_manager(app)
lm.request_loader(self.request_loader)
return lm

def request_loader(self, request: Request) -> Optional[User]:
# pylint: disable=import-outside-toplevel
from superset.extensions import feature_flag_manager

lm = super().create_login_manager(app)
if feature_flag_manager.is_feature_enabled("EMBEDDED_SUPERSET"):
lm.request_loader(self.get_guest_user_from_request)
return lm
return self.get_guest_user_from_request(request)
return None

def get_schema_perm( # pylint: disable=no-self-use
self, database: Union["Database", str], schema: Optional[str] = None
Expand Down