dosubot[bot] commented on issue #36500: URL: https://github.com/apache/superset/issues/36500#issuecomment-3640164553
<!-- Answer --> The reason "View Query" is not working or is empty in embedded dashboards is due to permissions: embedded dashboards run under a guest/anonymous user context, which by default does not have the `can_view_query` permission. As a result, the "View Query" option is hidden or disabled for embedded viewers unless you explicitly grant this permission to the guest or Public role in your Superset security settings. There is no explicit code disabling "View Query" for embedded dashboards, but the lack of required permissions for guest users effectively prevents access to this feature in embedded mode [reference](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx#L151-L544). If you want to enable "View Query" for embedded dashboards, you can grant the `can_view_query` permission on the "Dashboard" resource to the guest or Public role. Be aware that this will allow anyone with access to the embedded dashboard to view the underlying SQL queries, which may have security or data exposure implications depending on your use case. If you update permissions and still don't see the feature, check for frontend or backend errors that might indicate another issue. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/f0aefbbd-faa5-4643-9103-26c725509f88?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/f0aefbbd-faa5-4643-9103-26c725509f88?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/f0aefbbd-faa5-4643-9103-26c725509f88?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/f0aefbbd-faa5-4643-9103-26c725509f88?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/f0aefbbd-faa5-4643-9103-26c725509f88?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/f0aefbbd-faa5-4643-9103-26c725509f88?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/f0aefbbd-faa5-4643-9103-26c725509f88?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=The%20reason%20%22View%20Query%22%20is%20not%20working%20or%20is%20empty%20in%20embedded%20dashboards%20is%20due%20to%20permissions%3A%20embedded%20dashboards%20run%20under%20a%20guest/anonymous%20user%20context%2C%20which%20by%20default%20does%20not%20have%20the%20%60can_view_query%60%20permission.%20As%20a%20result%2C%20the%20%22View%20Query%22%20option%20is%20hidden%20or%20disabled%20for%20embedded%20viewers%20unless%20you%20explicitly%20grant%20this%20permission%20to%20the%20guest%20or%20Public%20role%20in%20your%20Superset%20security%20settings.%20There%20is%20no%20explicit%20code%20disabling%20%22View%20Query%22%20for%20embedded%20dashboards%2C%20but%20the%20lack%20of%20required%20permissions%20for%20guest%20users%20effectively%20prevents%20a ccess%20to%20this%20feature%20in%20embedded%20mode%C2%A0%5Breference%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx%23L151-L544%29.%0A%0AIf%20you%20want%20to%20enable%20%22View%20Query%22%20for%20embedded%20dashboards%2C%20you%20can%20grant%20the%20%60can_view_query%60%20permission%20on%20the%20%22Dashboard%22%20resource%20to%20the%20guest%20or%20Public%20role.%20Be%20aware%20that%20this%20will%20allow%20anyone%20with%20access%20to%20the%20embedded%20dashboard%20to%20view%20the%20underlying%20SQL%20queries%2C%20which%20may%20have%20security%20or%20data%20exposure%20implications%20depending%20on%20your%20use%20case.%0A%0AIf%20you%20update%20permissions%20and%20still%20don%27t%20see%20the%20feature%2C%20check%20for%20frontend%20or%20backend%20errors%20that%20might%20indicate%20another%20issue.) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/36500) -- 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]
