Skip to content

Commit

Permalink
fix: check embedded feature flag in request loader (#18628)
Browse files Browse the repository at this point in the history
* check embedded feature flag in request loader

* lint

* type annotation

Co-authored-by: David Aaron Suddjian <[email protected]>
  • Loading branch information
Lily Kuang and suddjian authored Feb 9, 2022
1 parent 51f716f commit e86f6bb
Showing 1 changed file with 7 additions and 3 deletions.
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

0 comments on commit e86f6bb

Please sign in to comment.