dosubot[bot] commented on issue #21882:
URL: https://github.com/apache/superset/issues/21882#issuecomment-2159342509
<!-- Greeting -->
Hey @rusackas! 👋 I'm here to help you with any bugs, questions, or
contributions while you wait for a human maintainer. Let's squash those bugs
together! 🐞
<!-- Answer -->
To disable the "Impersonate logged-in user" flag in a Google Sheet DB
connection using the shillelagh module in Superset 1.5.0, ensure that the
`impersonate_user` parameter is set to `False` when calling the
`get_url_for_impersonation` method. Here is the relevant part of the code:
```python
@classmethod
def get_url_for_impersonation(
cls,
url: URL,
impersonate_user: bool,
username: str | None,
access_token: str | None,
) -> URL:
if not impersonate_user:
return url
if username is not None:
user = security_manager.find_user(username=username)
if user and user.email:
url = url.update_query_dict({"subject": user.email})
if access_token:
url = url.update_query_dict({"access_token": access_token})
return url
}
```
Ensure that `impersonate_user` is set to `False` when this method is called.
Additionally, verify the frontend settings in the Superset UI. Specifically,
check the `ExtraOptions` component in
`superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx`:
```tsx
<StyledInputContainer>
<div className="input-container">
<IndeterminateCheckbox
id="impersonate_user"
indeterminate={false}
checked={!!db?.impersonate_user}
onChange={onInputChange}
labelText={t(
'Impersonate logged in user (Presto, Trino, Drill, Hive, and
GSheets)',
)}
/>
<InfoTooltip
tooltip={t(
'If Presto or Trino, all the queries in SQL Lab are going to be
executed as the ' +
'currently logged on user who must have permission to run them. If
Hive ' +
'and hive.server2.enable.doAs is enabled, will run the queries as
' +
'service account, but impersonate the currently logged on user via
' +
'hive.server2.proxy.user property.',
)}
/>
</div>
</StyledInputContainer>
```
Ensure that the checkbox for "Impersonate logged in user" is unchecked in
the database connection settings. This should reflect the `impersonate_user`
parameter being set to `False`. If the flag remains enabled despite your
attempts to disable it, you may need to check both the backend method call and
the frontend settings to ensure consistency
<sup>[[1]](https://github.com/apache/superset/blob/master/superset/db_engine_specs/gsheets.py)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]