You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by li...@apache.org on 2022/02/26 00:17:12 UTC

[superset] branch fix/guest-access-handling created (now ef8faaf)

This is an automated email from the ASF dual-hosted git repository.

lilykuang pushed a change to branch fix/guest-access-handling
in repository https://gitbox.apache.org/repos/asf/superset.git.


      at ef8faaf  comment out ROW_LEVEL_SECURITY

This branch includes the following new commits:

     new 77cb195  logging
     new aef7680  blah
     new ef8faaf  comment out ROW_LEVEL_SECURITY

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[superset] 02/03: blah

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lilykuang pushed a commit to branch fix/guest-access-handling
in repository https://gitbox.apache.org/repos/asf/superset.git

commit aef76804861e24ea8eb3882d1d394e60e52eb7d9
Author: David Aaron Suddjian <aa...@gmail.com>
AuthorDate: Fri Feb 25 14:55:14 2022 -0800

    blah
---
 superset/connectors/sqla/models.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py
index ca1d4bc..cc2ecc1 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -990,7 +990,11 @@ class SqlaTable(Model, BaseDatasource):  # pylint: disable=too-many-public-metho
                 else:
                     all_filters.append(clause)
 
-            if is_feature_enabled("EMBEDDED_SUPERSET"):
+            is_embedded = is_feature_enabled("EMBEDDED_SUPERSET")
+            logging.warning(
+                f"!debugging! _get_sqla_row_level_filters feature flag: {is_embedded}"
+            )
+            if is_embedded:
                 for rule in security_manager.get_guest_rls_filters(self):
                     clause = self.text(
                         f"({template_processor.process_template(rule['clause'])})"

[superset] 01/03: logging

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lilykuang pushed a commit to branch fix/guest-access-handling
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 77cb195f7847ce96bc82b05dfcf3b233b2df8d96
Author: David Aaron Suddjian <aa...@gmail.com>
AuthorDate: Fri Feb 25 12:35:24 2022 -0800

    logging
---
 superset/security/manager.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/superset/security/manager.py b/superset/security/manager.py
index 0bed447..2d57fde 100644
--- a/superset/security/manager.py
+++ b/superset/security/manager.py
@@ -1132,13 +1132,17 @@ class SupersetSecurityManager(  # pylint: disable=too-many-public-methods
         :return: A list of filters
         """
         guest_user = self.get_current_guest_user_if_guest()
+        logging.warning(f"!debugging! get_guest_rls_filters guest user: {guest_user}")
+        logging.warning(f"!debugging! get_guest_rls_filters g.user: {g.user}")
         if guest_user:
-            return [
+            rules = [
                 rule
                 for rule in guest_user.rls
                 if not rule.get("dataset")
                 or str(rule.get("dataset")) == str(dataset.id)
             ]
+            logging.warning(f"!debugging! get_guest_rls_filters rules: {rules}")
+            return rules
         return []
 
     def get_rls_filters(self, table: "BaseDatasource") -> List[SqlaQuery]:

[superset] 03/03: comment out ROW_LEVEL_SECURITY

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lilykuang pushed a commit to branch fix/guest-access-handling
in repository https://gitbox.apache.org/repos/asf/superset.git

commit ef8faaf2a2e28f1724032293fc9b78fbde8e7de7
Author: Lily Kuang <li...@preset.io>
AuthorDate: Fri Feb 25 16:06:06 2022 -0800

    comment out ROW_LEVEL_SECURITY
---
 superset/connectors/sqla/models.py | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py
index cc2ecc1..952ae90 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -994,12 +994,12 @@ class SqlaTable(Model, BaseDatasource):  # pylint: disable=too-many-public-metho
             logging.warning(
                 f"!debugging! _get_sqla_row_level_filters feature flag: {is_embedded}"
             )
-            if is_embedded:
-                for rule in security_manager.get_guest_rls_filters(self):
-                    clause = self.text(
-                        f"({template_processor.process_template(rule['clause'])})"
-                    )
-                    all_filters.append(clause)
+            # if is_embedded:
+            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)
@@ -1358,8 +1358,12 @@ class SqlaTable(Model, BaseDatasource):  # pylint: disable=too-many-public-metho
                         raise QueryObjectValidationError(
                             _("Invalid filter operation type: %(op)s", op=op)
                         )
-        if is_feature_enabled("ROW_LEVEL_SECURITY"):
-            where_clause_and += self._get_sqla_row_level_filters(template_processor)
+        # if is_feature_enabled("ROW_LEVEL_SECURITY"):
+        is_rls = is_feature_enabled("ROW_LEVEL_SECURITY")
+        logging.warning(
+            f"!debugging! _get_sqla_query feature flag (ROW_LEVEL_SECURITY): {is_rls}"
+        )
+        where_clause_and += self._get_sqla_row_level_filters(template_processor)
         if extras:
             where = extras.get("where")
             if where: