Skip to content

Commit

Permalink
fall back to selenium user
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro committed Jan 20, 2023
1 parent e190ecb commit 23b8c08
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ assists people when migrating to a new version.

### Breaking Changes

- [22801](https://github.com/apache/superset/pull/22801): The Thumbnails feature has been changed to execute as the currently logged in user by default. To continue using the selenium user, please add the following to your `superset_config.py`: `THUMBNAILS_EXECUTE_AS = ["selenium"]`
- [22801](https://github.com/apache/superset/pull/22801): The Thumbnails feature has been changed to execute as the currently logged in user by default, falling back to the selenium user for anonymous users. To continue always using the selenium user, please add the following to your `superset_config.py`: `THUMBNAILS_EXECUTE_AS = ["selenium"]`
- [22328](https://github.com/apache/superset/pull/22328): For deployments that have enabled the "THUMBNAILS" feature flag, the function that calculates dashboard digests has been updated to consider additional properties to more accurately identify changes in the dashboard metadata. This change will invalidate all currently cached dashboard thumbnails.
- [21765](https://github.com/apache/superset/pull/21765): For deployments that have enabled the "ALERT_REPORTS" feature flag, Gamma users will no longer have read and write access to Alerts & Reports by default. To give Gamma users the ability to schedule reports from the Dashboard and Explore view like before, create an additional role with "can read on ReportSchedule" and "can write on ReportSchedule" permissions. To further give Gamma users access to the "Alerts & Reports" menu and CRUD view, add "menu access on Manage" and "menu access on Alerts & Report" permissions to the role.
- [22325](https://github.com/apache/superset/pull/22325): "RLS_FORM_QUERY_REL_FIELDS" is replaced by "RLS_BASE_RELATED_FIELD_FILTERS" feature flag.Its value format stays same.
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/installation/cache.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ FEATURE_FLAGS = {
}
```

By default thumbnails are rendered per user. To render thumbnails as a fixed user (`admin` in this example), use the following configuration:
By default thumbnails are rendered per user, and will fall back to the Selenium user for anonymous users.
To always render thumbnails as a fixed user (`admin` in this example), use the following configuration:

```python
from superset.tasks.types import ExecutorType
Expand Down
9 changes: 5 additions & 4 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,13 +611,14 @@ def _try_json_readsha(filepath: str, length: int) -> Optional[str]:
# ---------------------------------------------------
# Thumbnail config (behind feature flag)
# ---------------------------------------------------
# By default, thumbnails are rendered per user. Similar to Alerts & Reports, thumbnails
# can be configured to be rendered as a fixed user. See
# By default, thumbnails are rendered per user, and will fall back to the Selenium
# user for anonymous users. Similar to Alerts & Reports, thumbnails
# can be configured to always be rendered as a fixed user. See
# `superset.tasks.types.ExecutorType` for a full list of executor options.
# To use a fixed user account, use the following configuration:
# To always use a fixed user account, use the following configuration:
# THUMBNAIL_EXECUTE_AS = [ExecutorType.SELENIUM]
THUMBNAIL_SELENIUM_USER: Optional[str] = "admin"
THUMBNAIL_EXECUTE_AS = [ExecutorType.CURRENT_USER]
THUMBNAIL_EXECUTE_AS = [ExecutorType.CURRENT_USER, ExecutorType.SELENIUM]

# By default, thumbnail digests are calculated based on various parameters in the
# chart/dashboard metadata, and in the case of user-specific thumbnails, the
Expand Down
14 changes: 12 additions & 2 deletions tests/integration_tests/thumbnails_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,12 @@ def test_get_async_dashboard_screenshot_as_selenium(self):
Thumbnails: Simple get async dashboard screenshot as selenium user
"""
self.login(username="alpha")
with patch(
with patch.dict(
"superset.thumbnails.digest.current_app.config",
{
"THUMBNAIL_EXECUTE_AS": [ExecutorType.SELENIUM],
},
), patch(
"superset.thumbnails.digest._adjust_string_for_executor"
) as mock_adjust_string:
mock_adjust_string.return_value = self.digest_return_value
Expand Down Expand Up @@ -306,7 +311,12 @@ def test_get_async_chart_screenshot_as_selenium(self):
Thumbnails: Simple get async chart screenshot as selenium user
"""
self.login(username="alpha")
with patch(
with patch.dict(
"superset.thumbnails.digest.current_app.config",
{
"THUMBNAIL_EXECUTE_AS": [ExecutorType.SELENIUM],
},
), patch(
"superset.thumbnails.digest._adjust_string_for_executor"
) as mock_adjust_string:
mock_adjust_string.return_value = self.digest_return_value
Expand Down

0 comments on commit 23b8c08

Please sign in to comment.