benjreinhart commented on a change in pull request #14684:
URL: https://github.com/apache/superset/pull/14684#discussion_r636424115



##########
File path: superset/connectors/sqla/views.py
##########
@@ -369,6 +371,15 @@ class RowLevelSecurityFiltersModelView(  # pylint: 
disable=too-many-ancestors
         add_form_query_rel_fields = app.config["RLS_FORM_QUERY_REL_FIELDS"]
         edit_form_query_rel_fields = add_form_query_rel_fields
 
+    @staticmethod
+    def is_enabled() -> bool:
+        return is_feature_enabled("ROW_LEVEL_SECURITY")
+
+    @before_request
+    def ensure_enabled(self) -> None:
+        if not self.is_enabled():
+            raise NotFound()

Review comment:
       I think we could, but it's a little bit more complicated then that. 
`@before_request` needs to be able to be scoped to a subset of route handlers 
in some cases. We can achieve that, but for now I think we should ship the more 
naive version. If this pattern continues to be used moving forward, the 
opportunity for a refactor should present itself.




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



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

Reply via email to