dosubot[bot] commented on issue #34203:
URL: https://github.com/apache/superset/issues/34203#issuecomment-3083509840

   <!-- Greeting -->
   Hi @saadmuqtadeer! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping 
the superset team.
   
   <!-- Answer -->
   Superset expects each RLS rule in the guest token payload to use the key 
dataset (an integer dataset ID), not datasource. If you use datasource, 
Superset treats the rule as global and applies it to all datasets, which causes 
errors when columns referenced in the clause don't exist in every dataset [see 
code 
logic](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/security/manager.py).
   
   Here's how your rlsRules should look:
   
   ```csharp
   var rlsRules = new List<object>
   {
       new {
           dataset = 41,
           clause = $"'{email}' = ANY(capabilityowner)"
       },
       new {
           dataset = 42,
           clause = $"'{email}' = ANY(businessowner) OR '{email}' = 
ANY(technicalowner)"
       },
       new {
           dataset = 43,
           clause = $"'{email}' = ANY(businessowner) OR '{email}' = 
ANY(technicalowner)"
       }
   };
   ```
   
   Make sure the dataset field is an integer and matches the dataset's actual 
ID in Superset. This will ensure each RLS clause is only applied to the 
intended dataset. If you want a global RLS rule, omit the dataset field 
entirely in that rule.
   
   The generated guest token itself won't show datasource details in the JWT 
payload, but Superset will apply the rules correctly if the payload structure 
is right 
[reference](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/security/api.py).
   
   If you still see errors, double-check that the dataset IDs are correct and 
that the referenced columns exist in those datasets.
   
   
   <!-- 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/2ff9ae4f-4fde-4f4c-8da0-945e47ab0df2?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/2ff9ae4f-4fde-4f4c-8da0-945e47ab0df2?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/2ff9ae4f-4fde-4f4c-8da0-945e47ab0df2?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/2ff9ae4f-4fde-4f4c-8da0-945e47ab0df2?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/2ff9ae4f-4fde-4f4c-8da0-945e47ab0df2?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/2ff9ae4f-4fde-4f4c-8da0-945e47ab0df2?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/2ff9ae4f-4fde-4f4c-8da0-945e47ab0df2?feedback_type=other)</sup>&nbsp;&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[!
 [Share on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/34203)


-- 
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]

Reply via email to