You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "michael-s-molina (via GitHub)" <gi...@apache.org> on 2023/09/13 14:45:51 UTC

[GitHub] [superset] michael-s-molina commented on a diff in pull request #24046: chore(security): Make get_database_perm/get_dataset_perm return optional

michael-s-molina commented on code in PR #24046:
URL: https://github.com/apache/superset/pull/24046#discussion_r1324630696


##########
superset/security/manager.py:
##########
@@ -1271,7 +1283,7 @@ def dataset_after_insert(
         )
 
         try:
-            dataset_perm = target.get_perm()
+            dataset_perm: Optional[str] = target.get_perm()

Review Comment:
   ```suggestion
               dataset_perm: str | None = target.get_perm()
   ```



##########
superset/security/manager.py:
##########
@@ -320,11 +320,15 @@ def get_schema_perm(  # pylint: disable=no-self-use
         return None
 
     @staticmethod
-    def get_database_perm(database_id: int, database_name: str) -> str:
+    def get_database_perm(database_id: int, database_name: str) -> Optional[str]:
         return f"[{database_name}].(id:{database_id})"
 
     @staticmethod
-    def get_dataset_perm(dataset_id: int, dataset_name: str, database_name: str) -> str:
+    def get_dataset_perm(
+        dataset_id: int,
+        dataset_name: str,
+        database_name: str,
+    ) -> Optional[str]:

Review Comment:
   ```suggestion
       ) -> str | None:
   ```



##########
superset/security/manager.py:
##########
@@ -320,11 +320,15 @@ def get_schema_perm(  # pylint: disable=no-self-use
         return None
 
     @staticmethod
-    def get_database_perm(database_id: int, database_name: str) -> str:
+    def get_database_perm(database_id: int, database_name: str) -> Optional[str]:

Review Comment:
   ```suggestion
       def get_database_perm(database_id: int, database_name: str) -> str | None:
   ```



-- 
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-unsubscribe@superset.apache.org

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


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