neuromantik33 opened a new issue, #33775:
URL: https://github.com/apache/superset/issues/33775

   ### Bug description
   
   There is a regression in the PR fix(Jinja): Extra cache keys to consider 
vars with set #30549 . I mentioned it as a comment within the PR but I guess 
since it's merged I'm filing a proper bug report.
   
   This PR breaks are existing usage of RLS (thank heavens one for our campus 
users notified us 😅 ). This is our input string:
   ```sql
   campus_id IN UNNEST( {{ cache_key_wrapper(current_user_campus_ids()) }} )
   ```
   which doesn't match using the pattern : `cache_key_wrapper\([^()]*\)`,
   but does using the old one (v4.0.2): `cache_key_wrapper\(.*\)`.
   
   The function we use looks as follows:
   ```python
   def current_user_campus_ids() -> list[int]:
       """
       Get the list of campus ids associated with the current user
       """
       user: FortyTwoUser = g.user
       return user.campus_ids()
   ```
   and is populated using the oauth2 jwt from keycloak.
   Is the only workaround to monkey patch the jinja `ExtraCache` processor to 
add our macro within? How is the `cache_key_wrapper()` to be used if it can't 
invoke another function?
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   master / latest-dev
   
   ### Python version
   
   3.10
   
   ### Node version
   
   I don't know
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [x] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


-- 
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: notifications-unsubscr...@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to