mistercrunch commented on a change in pull request #8699: [SIP-29] Add support 
for row-level security
URL: 
https://github.com/apache/incubator-superset/pull/8699#discussion_r353562814
 
 

 ##########
 File path: superset/connectors/sqla/models.py
 ##########
 @@ -977,6 +977,17 @@ def _get_top_groups(
         return or_(*groups)
 
     def query(self, query_obj: Dict) -> QueryResult:
+        filters = security_manager.get_row_level_security_filters(
+            self
+        )  # Self is the Table model
+        if len(filters) > 0:
+            where = query_obj["extras"]["where"]
+            if len(where) > 0:
+                where = "({}) AND ".format(where)
 
 Review comment:
   Would be better to use the SQLA expression toolkit. `from sqlalchemy import 
and_`, `from sqlalchemy.sql import text`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to