Skip to content

Commit

Permalink
update docs and remove redundant import
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro committed Oct 31, 2022
1 parent 7b820c6 commit adeaeb2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
22 changes: 16 additions & 6 deletions docs/docs/installation/alerts-reports.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ to specify on behalf of which username to render the dashboards. In general dash
are not accessible to unauthorized requests, that is why the worker needs to take over credentials
of an existing user to take a snapshot.

By default, Alerts and Reports are executed by the user that the `THUMBNAIL_SELENIUM_USER` config
By default, Alerts and Reports are executed as the user that the `THUMBNAIL_SELENIUM_USER` config
parameter is set to. To change this user, just change the config as follows:

```python
Expand All @@ -382,13 +382,23 @@ In addition, it's also possible to execute the reports as the report owners/crea
needed if there isn't a central service account that has access to all objects or databases (e.g.
when using user impersonation on database connections). For this there's the config flag
`ALERTS_REPORTS_EXECUTE_AS` which makes it possible to customize how alerts and reports are executed.
For example, to first try to execute as the creator, then fall back to last modifier if the creator is
undefined, then an owner (it will first prioritize the last modifier and then the creator if either is
contained within the list of owners, otherwise the first owner owner will be used) and finally
`THUMBNAIL_SELENIUM_USER` if no creators, modifiers or owners are found, set as follows:
To first try to execute as the creator in the owners list (if present), then fall
back to the creator, then the last modifier in the owners list (if present), then the
last modifier, then an owner (giving priority to the last modifier and then the
creator if either is contained within the list of owners, otherwise the first owner
will be used) and finally `THUMBNAIL_SELENIUM_USER`, set as follows:

```python
ALERT_REPORTS_EXECUTE_AS = ["creator", "modifier", "owner", "selenium"]
from superset.reports.types import ReportScheduleExecutor

ALERT_REPORTS_EXECUTE_AS = [
ReportScheduleExecutor.CREATOR_OWNER,
ReportScheduleExecutor.CREATOR,
ReportScheduleExecutor.MODIFIER_OWNER,
ReportScheduleExecutor.MODIFIER,
ReportScheduleExecutor.OWNER,
ReportScheduleExecutor.SELENIUM,
]
```

**Important notes**
Expand Down
5 changes: 3 additions & 2 deletions tests/integration_tests/reports/commands_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
ReportScheduleValidatorType,
ReportState,
)
from superset.reports.types import ReportScheduleExecutor
from superset.utils.database import get_example_database
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices,
Expand Down Expand Up @@ -671,11 +672,11 @@ def test_email_chart_report_schedule_alpha_owner(
):
"""
ExecuteReport Command: Test chart email report schedule with screenshot
executed as the chart creator
executed as the chart owner
"""
config_key = "ALERT_REPORTS_EXECUTE_AS"
original_config_value = app.config[config_key]
app.config[config_key] = ["owner"]
app.config[config_key] = [ReportScheduleExecutor.OWNER]

# setup screenshot mock
username = ""
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/reports/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# under the License.

import json
from contextlib import contextmanager, nullcontext
from contextlib import contextmanager
from typing import Any, Dict, List, Optional
from uuid import uuid4

Expand Down

0 comments on commit adeaeb2

Please sign in to comment.