This is an automated email from the ASF dual-hosted git repository. beto pushed a commit to branch refactor-sql-functions in repository https://gitbox.apache.org/repos/asf/superset.git
commit c04159638a6cd52ac091de5f3b948d51a382548f Author: Beto Dealmeida <[email protected]> AuthorDate: Fri Mar 15 15:28:46 2024 -0400 wIP --- superset/connectors/sqla/models.py | 42 -------------------------------------- 1 file changed, 42 deletions(-) diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py index dd9334d9d0..2689e060a2 100644 --- a/superset/connectors/sqla/models.py +++ b/superset/connectors/sqla/models.py @@ -1582,48 +1582,6 @@ class SqlaTable( if is_alias_used_in_orderby(col): col.name = f"{col.name}__" - def get_sqla_row_level_filters( - self, - template_processor: BaseTemplateProcessor, - ) -> list[TextClause]: - """ - Return the appropriate row level security filters for this table and the - current user. A custom username can be passed when the user is not present in the - Flask global namespace. - - :param template_processor: The template processor to apply to the filters. - :returns: A list of SQL clauses to be ANDed together. - """ - all_filters: list[TextClause] = [] - filter_groups: dict[int | str, list[TextClause]] = defaultdict(list) - try: - for filter_ in security_manager.get_rls_filters(self): - clause = self.text( - f"({template_processor.process_template(filter_.clause)})" - ) - if filter_.group_key: - filter_groups[filter_.group_key].append(clause) - else: - all_filters.append(clause) - - if is_feature_enabled("EMBEDDED_SUPERSET"): - for rule in security_manager.get_guest_rls_filters(self): - clause = self.text( - f"({template_processor.process_template(rule['clause'])})" - ) - all_filters.append(clause) - - grouped_filters = [or_(*clauses) for clauses in filter_groups.values()] - all_filters.extend(grouped_filters) - return all_filters - except TemplateError as ex: - raise QueryObjectValidationError( - _( - "Error in jinja expression in RLS filters: %(msg)s", - msg=ex.message, - ) - ) from ex - def text(self, clause: str) -> TextClause: return self.db_engine_spec.get_text_clause(clause)
