You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/03/07 23:47:57 UTC

[GitHub] [superset] AAfghahi opened a new pull request #19051: fix: update Permissions for right nav

AAfghahi opened a new pull request #19051:
URL: https://github.com/apache/superset/pull/19051


   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


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


[GitHub] [superset] eschutho commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
eschutho commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r839934237



##########
File path: superset/databases/filters.py
##########
@@ -51,3 +57,37 @@ def apply(self, query: Query, value: Any) -> Query:
                 ),
             )
         )
+
+
+class DatabaseUploadEnabledFilter(BaseFilter):  # pylint: disable=too-few-public-methods
+    """
+    Custom filter for the GET list that filters all certified charts
+    """
+
+    name = _("Upload Enabled")
+    arg_name = "upload_is_enabled"
+    model = Database
+
+    def apply(self, query: Query, value: any) -> Query:
+        extra_allowed_databases = []
+        if hasattr(g, "user"):
+            extra_allowed_databases += app.config["ALLOWED_USER_CSV_SCHEMA_FUNC"](
+                Database, g.user
+            )
+        if len(extra_allowed_databases):

Review comment:
       looking at this now, we may want to add a comment that to keep this simple, we're not going to check to see if these schemas actually exist in any of the databases. 




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #19051:
URL: https://github.com/apache/superset/pull/19051#issuecomment-1063272299


   # [Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#19051](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d3bf60b) into [master](https://codecov.io/gh/apache/superset/commit/f53f86f7965b9f4e98c40047ec6d64016d5adc53?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f53f86f) will **decrease** coverage by `0.15%`.
   > The diff coverage is `84.21%`.
   
   > :exclamation: Current head d3bf60b differs from pull request most recent head 611b14b. Consider uploading reports for the commit 611b14b to get more accurate results
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/19051/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #19051      +/-   ##
   ==========================================
   - Coverage   66.51%   66.35%   -0.16%     
   ==========================================
     Files        1643     1643              
     Lines       63468    63476       +8     
     Branches     6451     6451              
   ==========================================
   - Hits        42214    42118      -96     
   - Misses      19585    19689     +104     
     Partials     1669     1669              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `52.60% <66.66%> (+<0.01%)` | :arrow_up: |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `52.44% <66.66%> (+<0.01%)` | :arrow_up: |
   | python | `81.97% <66.66%> (-0.33%)` | :arrow_down: |
   | sqlite | `81.61% <66.66%> (-0.01%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/constants.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29uc3RhbnRzLnB5) | `100.00% <ø> (ø)` | |
   | [superset/databases/api.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2FwaS5weQ==) | `87.28% <66.66%> (-6.71%)` | :arrow_down: |
   | [...perset-frontend/src/views/components/MenuRight.tsx](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL2NvbXBvbmVudHMvTWVudVJpZ2h0LnRzeA==) | `72.13% <100.00%> (ø)` | |
   | [superset/sql\_validators/postgres.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc3FsX3ZhbGlkYXRvcnMvcG9zdGdyZXMucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [superset/databases/commands/create.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL2NyZWF0ZS5weQ==) | `64.70% <0.00%> (-27.46%)` | :arrow_down: |
   | [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `60.34% <0.00%> (-20.69%)` | :arrow_down: |
   | [superset/databases/commands/update.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL3VwZGF0ZS5weQ==) | `85.71% <0.00%> (-8.17%)` | :arrow_down: |
   | [superset/common/utils/dataframe\_utils.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3V0aWxzL2RhdGFmcmFtZV91dGlscy5weQ==) | `85.71% <0.00%> (-7.15%)` | :arrow_down: |
   | ... and [14 more](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f53f86f...611b14b](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] eschutho commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
eschutho commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r823096565



##########
File path: superset/databases/api.py
##########
@@ -1039,3 +1040,40 @@ def validate_parameters(self) -> FlaskResponse:
         command = ValidateDatabaseParametersCommand(g.user, payload)
         command.run()
         return self.response(200, message="OK")
+
+    @expose("/upload_enabled/", methods=["GET"])

Review comment:
       did you decide against the restful api route?




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


[GitHub] [superset] eschutho commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
eschutho commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r840793411



##########
File path: superset/databases/filters.py
##########
@@ -51,3 +57,38 @@ def apply(self, query: Query, value: Any) -> Query:
                 ),
             )
         )
+
+
+class DatabaseUploadEnabledFilter(BaseFilter):  # pylint: disable=too-few-public-methods
+    """
+    Custom filter for the GET list that filters all certified charts

Review comment:
       this comment here is copy pasta.




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


[GitHub] [superset] lyndsiWilliams commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
lyndsiWilliams commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r823295925



##########
File path: superset-frontend/src/views/components/MenuRight.tsx
##########
@@ -144,6 +168,18 @@ const RightMenu = ({
     },
   ];
 
+  const hasFileUploadEnabled = () => {
+    SupersetClient.get({
+      endpoint: '/api/v1/database/upload_enabled',
+    }).then(({ json }: Record<string, any>) => {
+      setAllowUploads(json.can_upload);
+    });
+  };
+
+  useEffect(() => {
+    hasFileUploadEnabled();
+  }, []);

Review comment:
       ```suggestion
     useEffect(() => hasFileUploadEnabled(), []);
   ```
   Small nit, not blocking, but this can be written on one line.

##########
File path: superset-frontend/src/views/components/MenuRight.tsx
##########
@@ -165,14 +201,39 @@ const RightMenu = ({
     setShowModal(false);
   };
 
+  const isDisabled = isUserAdmin && !allowUploads;
+
+  const tooltipText = "Enable 'Allow data upload' in any database's settings";

Review comment:
       Should this string be `t()` translated?




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


[GitHub] [superset] github-actions[bot] commented on pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #19051:
URL: https://github.com/apache/superset/pull/19051#issuecomment-1063283606






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


[GitHub] [superset] eschutho commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
eschutho commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r830297691



##########
File path: superset/databases/api.py
##########
@@ -1039,3 +1061,44 @@ def validate_parameters(self) -> FlaskResponse:
         command = ValidateDatabaseParametersCommand(g.user, payload)
         command.run()
         return self.response(200, message="OK")
+
+    @expose("/upload_enabled/", methods=["GET"])
+    @protect()
+    @statsd_metrics
+    @event_logger.log_this_with_context(
+        action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
+        f".upload_enabled",
+        log_to_statsd=False,
+    )
+    def upload_enabled(self) -> Response:
+        """Returns a boolean saying whether uploads are enabled for the user
+        ---
+        get:
+          description:
+            Get the status of if any databases have allow file upload enabled
+            and also have a schema in a database that can have files uploaded to it.
+          responses:
+            200:
+              description: Database names
+              content:
+                application/json:
+                  schema:
+                    type: boolean
+            400:
+              $ref: '#/components/responses/400'
+            500:
+              $ref: '#/components/responses/500'
+        """
+        try:
+            dbs_with_uploads = (
+                db.session.query(Database).filter_by(allow_file_upload=True).all()
+            )
+
+            allow_uploads = any(
+                len(db.get_schema_access_for_file_upload()) >= 1

Review comment:
       @AAfghahi this may be complicated but I think we will need to check if the schemas in the config are part of those dbs. 




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


[GitHub] [superset] eschutho commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
eschutho commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r840806857



##########
File path: superset/databases/filters.py
##########
@@ -51,3 +57,38 @@ def apply(self, query: Query, value: Any) -> Query:
                 ),
             )
         )
+
+
+class DatabaseUploadEnabledFilter(BaseFilter):  # pylint: disable=too-few-public-methods
+    """
+    Custom filter for the GET list that filters all certified charts
+    """
+
+    name = _("Upload Enabled")
+    arg_name = "upload_is_enabled"
+    model = Database
+
+    def apply(self, query: Query, value: any) -> Query:
+        extra_allowed_databases = []

Review comment:
       since we don't use this again, you can remove it and just return 
   ```
   pp.config["ALLOWED_USER_CSV_SCHEMA_FUNC"](
                   Database, g.user
               )
               ```
               on line 74




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


[GitHub] [superset] AAfghahi commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
AAfghahi commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r823026928



##########
File path: superset/databases/api.py
##########
@@ -1039,3 +1040,40 @@ def validate_parameters(self) -> FlaskResponse:
         command = ValidateDatabaseParametersCommand(g.user, payload)
         command.run()
         return self.response(200, message="OK")
+
+    @expose("/upload_enabled/", methods=["GET"])
+    @protect()
+    @statsd_metrics
+    @event_logger.log_this_with_context(
+        action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
+        f".upload_enabled",
+        log_to_statsd=False,
+    )
+    def upload_enabled(self) -> Response:
+        """Returns a boolean saying whether uploads are enabled for the user
+        ---
+        get:
+          description:
+            Get the status of if any databases have allow file upload enabled
+            and also have a schema in a database that can have files uploaded to it.
+          responses:
+            200:
+              description: Database names
+              content:
+                application/json:
+                  schema:
+                    type: boolean
+            400:
+              $ref: '#/components/responses/400'
+            500:
+              $ref: '#/components/responses/500'
+        """
+        dbs_with_uploads = (
+            db.session.query(Database).filter_by(allow_file_upload=True).all()

Review comment:
       What would a SIP-40 compliant error be? Also it is currently failing a test with:
    No fallback response defined for GET to http://localhost/api/v1/database/upload_enabled".]
   
   seems to be in a fetchMock. Are those related?
   




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


[GitHub] [superset] pkdotson commented on pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
pkdotson commented on pull request #19051:
URL: https://github.com/apache/superset/pull/19051#issuecomment-1063283039


   /testenv up


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


[GitHub] [superset] AAfghahi commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
AAfghahi commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r823874624



##########
File path: superset-frontend/src/views/components/MenuRight.tsx
##########
@@ -144,6 +168,18 @@ const RightMenu = ({
     },
   ];
 
+  const hasFileUploadEnabled = () => {
+    SupersetClient.get({
+      endpoint: '/api/v1/database/upload_enabled',
+    }).then(({ json }: Record<string, any>) => {
+      setAllowUploads(json.can_upload);
+    });
+  };
+
+  useEffect(() => {
+    hasFileUploadEnabled();
+  }, []);

Review comment:
       Oh I can actually just delete this useEffect. 




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #19051:
URL: https://github.com/apache/superset/pull/19051#issuecomment-1063272299


   # [Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#19051](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d3bf60b) into [master](https://codecov.io/gh/apache/superset/commit/f53f86f7965b9f4e98c40047ec6d64016d5adc53?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f53f86f) will **decrease** coverage by `0.15%`.
   > The diff coverage is `84.21%`.
   
   > :exclamation: Current head d3bf60b differs from pull request most recent head 7527656. Consider uploading reports for the commit 7527656 to get more accurate results
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/19051/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #19051      +/-   ##
   ==========================================
   - Coverage   66.51%   66.35%   -0.16%     
   ==========================================
     Files        1643     1643              
     Lines       63468    63476       +8     
     Branches     6451     6451              
   ==========================================
   - Hits        42214    42118      -96     
   - Misses      19585    19689     +104     
     Partials     1669     1669              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `52.60% <66.66%> (+<0.01%)` | :arrow_up: |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `52.44% <66.66%> (+<0.01%)` | :arrow_up: |
   | python | `81.97% <66.66%> (-0.33%)` | :arrow_down: |
   | sqlite | `81.61% <66.66%> (-0.01%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/constants.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29uc3RhbnRzLnB5) | `100.00% <ø> (ø)` | |
   | [superset/databases/api.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2FwaS5weQ==) | `87.28% <66.66%> (-6.71%)` | :arrow_down: |
   | [...perset-frontend/src/views/components/MenuRight.tsx](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL2NvbXBvbmVudHMvTWVudVJpZ2h0LnRzeA==) | `72.13% <100.00%> (ø)` | |
   | [superset/sql\_validators/postgres.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc3FsX3ZhbGlkYXRvcnMvcG9zdGdyZXMucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [superset/databases/commands/create.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL2NyZWF0ZS5weQ==) | `64.70% <0.00%> (-27.46%)` | :arrow_down: |
   | [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `60.34% <0.00%> (-20.69%)` | :arrow_down: |
   | [superset/databases/commands/update.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL3VwZGF0ZS5weQ==) | `85.71% <0.00%> (-8.17%)` | :arrow_down: |
   | [superset/common/utils/dataframe\_utils.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3V0aWxzL2RhdGFmcmFtZV91dGlscy5weQ==) | `85.71% <0.00%> (-7.15%)` | :arrow_down: |
   | ... and [14 more](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f53f86f...7527656](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] codecov[bot] edited a comment on pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #19051:
URL: https://github.com/apache/superset/pull/19051#issuecomment-1063272299


   # [Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#19051](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d3bf60b) into [master](https://codecov.io/gh/apache/superset/commit/f53f86f7965b9f4e98c40047ec6d64016d5adc53?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f53f86f) will **decrease** coverage by `0.15%`.
   > The diff coverage is `84.21%`.
   
   > :exclamation: Current head d3bf60b differs from pull request most recent head ceb6b5e. Consider uploading reports for the commit ceb6b5e to get more accurate results
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/19051/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #19051      +/-   ##
   ==========================================
   - Coverage   66.51%   66.35%   -0.16%     
   ==========================================
     Files        1643     1643              
     Lines       63468    63476       +8     
     Branches     6451     6451              
   ==========================================
   - Hits        42214    42118      -96     
   - Misses      19585    19689     +104     
     Partials     1669     1669              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `52.60% <66.66%> (+<0.01%)` | :arrow_up: |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `52.44% <66.66%> (+<0.01%)` | :arrow_up: |
   | python | `81.97% <66.66%> (-0.33%)` | :arrow_down: |
   | sqlite | `81.61% <66.66%> (-0.01%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/constants.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29uc3RhbnRzLnB5) | `100.00% <ø> (ø)` | |
   | [superset/databases/api.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2FwaS5weQ==) | `87.28% <66.66%> (-6.71%)` | :arrow_down: |
   | [...perset-frontend/src/views/components/MenuRight.tsx](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL2NvbXBvbmVudHMvTWVudVJpZ2h0LnRzeA==) | `72.13% <100.00%> (ø)` | |
   | [superset/sql\_validators/postgres.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc3FsX3ZhbGlkYXRvcnMvcG9zdGdyZXMucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [superset/databases/commands/create.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL2NyZWF0ZS5weQ==) | `64.70% <0.00%> (-27.46%)` | :arrow_down: |
   | [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `60.34% <0.00%> (-20.69%)` | :arrow_down: |
   | [superset/databases/commands/update.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL3VwZGF0ZS5weQ==) | `85.71% <0.00%> (-8.17%)` | :arrow_down: |
   | [superset/common/utils/dataframe\_utils.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3V0aWxzL2RhdGFmcmFtZV91dGlscy5weQ==) | `85.71% <0.00%> (-7.15%)` | :arrow_down: |
   | ... and [14 more](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f53f86f...ceb6b5e](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] eschutho commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
eschutho commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r840806857



##########
File path: superset/databases/filters.py
##########
@@ -51,3 +57,38 @@ def apply(self, query: Query, value: Any) -> Query:
                 ),
             )
         )
+
+
+class DatabaseUploadEnabledFilter(BaseFilter):  # pylint: disable=too-few-public-methods
+    """
+    Custom filter for the GET list that filters all certified charts
+    """
+
+    name = _("Upload Enabled")
+    arg_name = "upload_is_enabled"
+    model = Database
+
+    def apply(self, query: Query, value: any) -> Query:
+        extra_allowed_databases = []

Review comment:
       since we don't use this again, you can remove it and just return 
   ```
   app.config["ALLOWED_USER_CSV_SCHEMA_FUNC"](
                   Database, g.user
               )
   ```
               on line 74

##########
File path: superset/databases/filters.py
##########
@@ -51,3 +57,38 @@ def apply(self, query: Query, value: Any) -> Query:
                 ),
             )
         )
+
+
+class DatabaseUploadEnabledFilter(BaseFilter):  # pylint: disable=too-few-public-methods
+    """
+    Custom filter for the GET list that filters all certified charts
+    """
+
+    name = _("Upload Enabled")
+    arg_name = "upload_is_enabled"
+    model = Database
+
+    def apply(self, query: Query, value: any) -> Query:
+        extra_allowed_databases = []

Review comment:
       since we don't use this again, you can remove it and just return 
   ```
   app.config["ALLOWED_USER_CSV_SCHEMA_FUNC"](
                   Database, g.user
               )
   ```
    on line 74




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


[GitHub] [superset] hughhhh commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
hughhhh commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r823023668



##########
File path: superset/databases/api.py
##########
@@ -1039,3 +1040,40 @@ def validate_parameters(self) -> FlaskResponse:
         command = ValidateDatabaseParametersCommand(g.user, payload)
         command.run()
         return self.response(200, message="OK")
+
+    @expose("/upload_enabled/", methods=["GET"])
+    @protect()
+    @statsd_metrics
+    @event_logger.log_this_with_context(
+        action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
+        f".upload_enabled",
+        log_to_statsd=False,
+    )
+    def upload_enabled(self) -> Response:
+        """Returns a boolean saying whether uploads are enabled for the user
+        ---
+        get:
+          description:
+            Get the status of if any databases have allow file upload enabled
+            and also have a schema in a database that can have files uploaded to it.
+          responses:
+            200:
+              description: Database names
+              content:
+                application/json:
+                  schema:
+                    type: boolean
+            400:
+              $ref: '#/components/responses/400'
+            500:
+              $ref: '#/components/responses/500'
+        """
+        dbs_with_uploads = (
+            db.session.query(Database).filter_by(allow_file_upload=True).all()

Review comment:
       You could prolly just wrap it in a try/catch with a `SupersetException` then return a SIP-40 compliant error




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #19051:
URL: https://github.com/apache/superset/pull/19051#issuecomment-1063272299


   # [Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#19051](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d3bf60b) into [master](https://codecov.io/gh/apache/superset/commit/f53f86f7965b9f4e98c40047ec6d64016d5adc53?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f53f86f) will **decrease** coverage by `0.15%`.
   > The diff coverage is `84.21%`.
   
   > :exclamation: Current head d3bf60b differs from pull request most recent head b7ebdc5. Consider uploading reports for the commit b7ebdc5 to get more accurate results
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/19051/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #19051      +/-   ##
   ==========================================
   - Coverage   66.51%   66.35%   -0.16%     
   ==========================================
     Files        1643     1643              
     Lines       63468    63476       +8     
     Branches     6451     6451              
   ==========================================
   - Hits        42214    42118      -96     
   - Misses      19585    19689     +104     
     Partials     1669     1669              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `52.60% <66.66%> (+<0.01%)` | :arrow_up: |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `52.44% <66.66%> (+<0.01%)` | :arrow_up: |
   | python | `81.97% <66.66%> (-0.33%)` | :arrow_down: |
   | sqlite | `81.61% <66.66%> (-0.01%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/constants.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29uc3RhbnRzLnB5) | `100.00% <ø> (ø)` | |
   | [superset/databases/api.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2FwaS5weQ==) | `87.28% <66.66%> (-6.71%)` | :arrow_down: |
   | [...perset-frontend/src/views/components/MenuRight.tsx](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL2NvbXBvbmVudHMvTWVudVJpZ2h0LnRzeA==) | `72.13% <100.00%> (ø)` | |
   | [superset/sql\_validators/postgres.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc3FsX3ZhbGlkYXRvcnMvcG9zdGdyZXMucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [superset/databases/commands/create.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL2NyZWF0ZS5weQ==) | `64.70% <0.00%> (-27.46%)` | :arrow_down: |
   | [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `60.34% <0.00%> (-20.69%)` | :arrow_down: |
   | [superset/databases/commands/update.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL3VwZGF0ZS5weQ==) | `85.71% <0.00%> (-8.17%)` | :arrow_down: |
   | [superset/common/utils/dataframe\_utils.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3V0aWxzL2RhdGFmcmFtZV91dGlscy5weQ==) | `85.71% <0.00%> (-7.15%)` | :arrow_down: |
   | ... and [14 more](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f53f86f...b7ebdc5](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] eschutho commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
eschutho commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r840806857



##########
File path: superset/databases/filters.py
##########
@@ -51,3 +57,38 @@ def apply(self, query: Query, value: Any) -> Query:
                 ),
             )
         )
+
+
+class DatabaseUploadEnabledFilter(BaseFilter):  # pylint: disable=too-few-public-methods
+    """
+    Custom filter for the GET list that filters all certified charts
+    """
+
+    name = _("Upload Enabled")
+    arg_name = "upload_is_enabled"
+    model = Database
+
+    def apply(self, query: Query, value: any) -> Query:
+        extra_allowed_databases = []

Review comment:
       since we don't use this again, you can remove it and just return 
   ```
   app.config["ALLOWED_USER_CSV_SCHEMA_FUNC"](
                   Database, g.user
               )
               ```
               on line 74




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #19051:
URL: https://github.com/apache/superset/pull/19051#issuecomment-1063272299


   # [Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#19051](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d3bf60b) into [master](https://codecov.io/gh/apache/superset/commit/f53f86f7965b9f4e98c40047ec6d64016d5adc53?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f53f86f) will **decrease** coverage by `0.15%`.
   > The diff coverage is `84.21%`.
   
   > :exclamation: Current head d3bf60b differs from pull request most recent head 290ebdc. Consider uploading reports for the commit 290ebdc to get more accurate results
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/19051/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #19051      +/-   ##
   ==========================================
   - Coverage   66.51%   66.35%   -0.16%     
   ==========================================
     Files        1643     1643              
     Lines       63468    63476       +8     
     Branches     6451     6451              
   ==========================================
   - Hits        42214    42118      -96     
   - Misses      19585    19689     +104     
     Partials     1669     1669              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `52.60% <66.66%> (+<0.01%)` | :arrow_up: |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `52.44% <66.66%> (+<0.01%)` | :arrow_up: |
   | python | `81.97% <66.66%> (-0.33%)` | :arrow_down: |
   | sqlite | `81.61% <66.66%> (-0.01%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/constants.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29uc3RhbnRzLnB5) | `100.00% <ø> (ø)` | |
   | [superset/databases/api.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2FwaS5weQ==) | `87.28% <66.66%> (-6.71%)` | :arrow_down: |
   | [...perset-frontend/src/views/components/MenuRight.tsx](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL2NvbXBvbmVudHMvTWVudVJpZ2h0LnRzeA==) | `72.13% <100.00%> (ø)` | |
   | [superset/sql\_validators/postgres.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc3FsX3ZhbGlkYXRvcnMvcG9zdGdyZXMucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [superset/databases/commands/create.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL2NyZWF0ZS5weQ==) | `64.70% <0.00%> (-27.46%)` | :arrow_down: |
   | [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `60.34% <0.00%> (-20.69%)` | :arrow_down: |
   | [superset/databases/commands/update.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL3VwZGF0ZS5weQ==) | `85.71% <0.00%> (-8.17%)` | :arrow_down: |
   | [superset/common/utils/dataframe\_utils.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3V0aWxzL2RhdGFmcmFtZV91dGlscy5weQ==) | `85.71% <0.00%> (-7.15%)` | :arrow_down: |
   | ... and [14 more](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f53f86f...290ebdc](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] eschutho commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
eschutho commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r823095278



##########
File path: superset-frontend/src/views/components/MenuRight.tsx
##########
@@ -63,6 +79,9 @@ const StyledAnchor = styled.a`
 
 const { SubMenu } = Menu;
 
+// stole this from findPermission.ts
+const ADMIN_ROLE_NAME = 'admin';

Review comment:
       do you want to export this from `findPermission.ts` so that if it changes there, it will change here, too?




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


[GitHub] [superset] AAfghahi commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
AAfghahi commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r822986533



##########
File path: superset-frontend/src/views/components/MenuRight.tsx
##########
@@ -105,19 +129,22 @@ const RightMenu = ({
           label: t('Upload CSV to database'),
           name: 'Upload a CSV',
           url: '/csvtodatabaseview/form',
-          perm: CSV_EXTENSIONS,
+          perm: CSV_EXTENSIONS && showUploads,
+          upload: true,

Review comment:
       I don't understand, why would they be?




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


[GitHub] [superset] pkdotson commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
pkdotson commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r823008570



##########
File path: superset-frontend/src/views/components/MenuRight.tsx
##########
@@ -105,19 +129,19 @@ const RightMenu = ({
           label: t('Upload CSV to database'),
           name: 'Upload a CSV',
           url: '/csvtodatabaseview/form',
-          perm: CSV_EXTENSIONS,
+          perm: CSV_EXTENSIONS && showUploads,

Review comment:
       Nice like the dual perms checking!




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


[GitHub] [superset] codecov[bot] edited a comment on pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #19051:
URL: https://github.com/apache/superset/pull/19051#issuecomment-1063272299


   # [Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#19051](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d3bf60b) into [master](https://codecov.io/gh/apache/superset/commit/f53f86f7965b9f4e98c40047ec6d64016d5adc53?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f53f86f) will **decrease** coverage by `0.15%`.
   > The diff coverage is `84.21%`.
   
   > :exclamation: Current head d3bf60b differs from pull request most recent head 37eea72. Consider uploading reports for the commit 37eea72 to get more accurate results
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/19051/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #19051      +/-   ##
   ==========================================
   - Coverage   66.51%   66.35%   -0.16%     
   ==========================================
     Files        1643     1643              
     Lines       63468    63476       +8     
     Branches     6451     6451              
   ==========================================
   - Hits        42214    42118      -96     
   - Misses      19585    19689     +104     
     Partials     1669     1669              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `52.60% <66.66%> (+<0.01%)` | :arrow_up: |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `52.44% <66.66%> (+<0.01%)` | :arrow_up: |
   | python | `81.97% <66.66%> (-0.33%)` | :arrow_down: |
   | sqlite | `81.61% <66.66%> (-0.01%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/constants.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29uc3RhbnRzLnB5) | `100.00% <ø> (ø)` | |
   | [superset/databases/api.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2FwaS5weQ==) | `87.28% <66.66%> (-6.71%)` | :arrow_down: |
   | [...perset-frontend/src/views/components/MenuRight.tsx](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL2NvbXBvbmVudHMvTWVudVJpZ2h0LnRzeA==) | `72.13% <100.00%> (ø)` | |
   | [superset/sql\_validators/postgres.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc3FsX3ZhbGlkYXRvcnMvcG9zdGdyZXMucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [superset/databases/commands/create.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL2NyZWF0ZS5weQ==) | `64.70% <0.00%> (-27.46%)` | :arrow_down: |
   | [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `60.34% <0.00%> (-20.69%)` | :arrow_down: |
   | [superset/databases/commands/update.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL3VwZGF0ZS5weQ==) | `85.71% <0.00%> (-8.17%)` | :arrow_down: |
   | [superset/common/utils/dataframe\_utils.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3V0aWxzL2RhdGFmcmFtZV91dGlscy5weQ==) | `85.71% <0.00%> (-7.15%)` | :arrow_down: |
   | ... and [14 more](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f53f86f...37eea72](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] eschutho commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
eschutho commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r825205092



##########
File path: superset-frontend/src/views/components/MenuRight.tsx
##########
@@ -165,14 +196,41 @@ const RightMenu = ({
     setShowModal(false);
   };
 
+  const isDisabled = isAdmin && !allowUploads;
+
+  const tooltipText = t(
+    "Enable 'Allow data upload' in any database's settings",
+  );
+
+  const buildMenuItem = (item: Record<string, any>) => {
+    const disabledText = isDisabled && item.url;
+    return disabledText ? (
+      <Menu.Item key={item.name} css={styledDisabled}>
+        <Tooltip placement="top" title={tooltipText}>
+          {item.label}
+        </Tooltip>
+      </Menu.Item>
+    ) : (
+      <Menu.Item key={item.name}>
+        {item.url ? <a href={item.url}> {item.label} </a> : item.label}
+      </Menu.Item>
+    );
+  };
+
   return (
     <StyledDiv align={align}>
       <DatabaseModal
         onHide={handleOnHideModal}
         show={showModal}
+        onDatabaseAdd={() => {}}
         dbEngine={engine}
       />
-      <Menu selectable={false} mode="horizontal" onClick={handleMenuSelection}>
+      <Menu
+        selectable={false}
+        mode="horizontal"
+        onClick={handleMenuSelection}
+        onOpenChange={() => hasFileUploadEnabled()}

Review comment:
       nit, this can just be 
   ```
   onOpenChange={hasFileUploadEnabled}
   ```
   but also when testing it looks like this is also triggering on close, which you prob don't need.




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


[GitHub] [superset] codecov[bot] commented on pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on pull request #19051:
URL: https://github.com/apache/superset/pull/19051#issuecomment-1063272299


   # [Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#19051](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (3f476c0) into [master](https://codecov.io/gh/apache/superset/commit/f53f86f7965b9f4e98c40047ec6d64016d5adc53?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f53f86f) will **decrease** coverage by `0.15%`.
   > The diff coverage is `82.60%`.
   
   > :exclamation: Current head 3f476c0 differs from pull request most recent head 611b14b. Consider uploading reports for the commit 611b14b to get more accurate results
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/19051/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #19051      +/-   ##
   ==========================================
   - Coverage   66.51%   66.35%   -0.16%     
   ==========================================
     Files        1643     1643              
     Lines       63468    63476       +8     
     Branches     6451     6451              
   ==========================================
   - Hits        42214    42118      -96     
   - Misses      19585    19689     +104     
     Partials     1669     1669              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | hive | `52.60% <66.66%> (+<0.01%)` | :arrow_up: |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `52.44% <66.66%> (+<0.01%)` | :arrow_up: |
   | python | `81.97% <66.66%> (-0.33%)` | :arrow_down: |
   | sqlite | `81.61% <66.66%> (-0.01%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset-frontend/src/views/components/Menu.tsx](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL2NvbXBvbmVudHMvTWVudS50c3g=) | `58.97% <ø> (ø)` | |
   | [superset/constants.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29uc3RhbnRzLnB5) | `100.00% <ø> (ø)` | |
   | [superset/databases/api.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2FwaS5weQ==) | `87.28% <66.66%> (-6.71%)` | :arrow_down: |
   | [...perset-frontend/src/views/components/MenuRight.tsx](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL2NvbXBvbmVudHMvTWVudVJpZ2h0LnRzeA==) | `72.13% <92.85%> (ø)` | |
   | [superset/sql\_validators/postgres.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc3FsX3ZhbGlkYXRvcnMvcG9zdGdyZXMucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [superset/databases/commands/create.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL2NyZWF0ZS5weQ==) | `64.70% <0.00%> (-27.46%)` | :arrow_down: |
   | [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `60.34% <0.00%> (-20.69%)` | :arrow_down: |
   | [superset/databases/commands/update.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL3VwZGF0ZS5weQ==) | `85.71% <0.00%> (-8.17%)` | :arrow_down: |
   | [superset/common/utils/dataframe\_utils.py](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3V0aWxzL2RhdGFmcmFtZV91dGlscy5weQ==) | `85.71% <0.00%> (-7.15%)` | :arrow_down: |
   | ... and [16 more](https://codecov.io/gh/apache/superset/pull/19051/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f53f86f...611b14b](https://codecov.io/gh/apache/superset/pull/19051?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


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


[GitHub] [superset] pkdotson commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
pkdotson commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r822983010



##########
File path: superset-frontend/src/views/components/MenuRight.tsx
##########
@@ -105,19 +129,22 @@ const RightMenu = ({
           label: t('Upload CSV to database'),
           name: 'Upload a CSV',
           url: '/csvtodatabaseview/form',
-          perm: CSV_EXTENSIONS,
+          perm: CSV_EXTENSIONS && showUploads,
+          upload: true,

Review comment:
       would these need to be variable for the upload param?




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


[GitHub] [superset] AAfghahi commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
AAfghahi commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r840743261



##########
File path: superset/databases/filters.py
##########
@@ -51,3 +57,37 @@ def apply(self, query: Query, value: Any) -> Query:
                 ),
             )
         )
+
+
+class DatabaseUploadEnabledFilter(BaseFilter):  # pylint: disable=too-few-public-methods
+    """
+    Custom filter for the GET list that filters all certified charts
+    """
+
+    name = _("Upload Enabled")
+    arg_name = "upload_is_enabled"
+    model = Database
+
+    def apply(self, query: Query, value: any) -> Query:
+        extra_allowed_databases = []
+        if hasattr(g, "user"):
+            extra_allowed_databases += app.config["ALLOWED_USER_CSV_SCHEMA_FUNC"](
+                Database, g.user
+            )
+        if len(extra_allowed_databases):

Review comment:
       Added. 




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


[GitHub] [superset] AAfghahi commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
AAfghahi commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r823874210



##########
File path: superset-frontend/src/views/components/MenuRight.tsx
##########
@@ -165,14 +201,39 @@ const RightMenu = ({
     setShowModal(false);
   };
 
+  const isDisabled = isUserAdmin && !allowUploads;
+
+  const tooltipText = "Enable 'Allow data upload' in any database's settings";

Review comment:
       yes! Thank you. 




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


[GitHub] [superset] AAfghahi commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
AAfghahi commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r822986533



##########
File path: superset-frontend/src/views/components/MenuRight.tsx
##########
@@ -105,19 +129,22 @@ const RightMenu = ({
           label: t('Upload CSV to database'),
           name: 'Upload a CSV',
           url: '/csvtodatabaseview/form',
-          perm: CSV_EXTENSIONS,
+          perm: CSV_EXTENSIONS && showUploads,
+          upload: true,

Review comment:
       I don't understand, why would they be?




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


[GitHub] [superset] hughhhh commented on a change in pull request #19051: fix: update Permissions for right nav

Posted by GitBox <gi...@apache.org>.
hughhhh commented on a change in pull request #19051:
URL: https://github.com/apache/superset/pull/19051#discussion_r823022944



##########
File path: superset/databases/api.py
##########
@@ -1039,3 +1040,40 @@ def validate_parameters(self) -> FlaskResponse:
         command = ValidateDatabaseParametersCommand(g.user, payload)
         command.run()
         return self.response(200, message="OK")
+
+    @expose("/upload_enabled/", methods=["GET"])
+    @protect()
+    @statsd_metrics
+    @event_logger.log_this_with_context(
+        action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
+        f".upload_enabled",
+        log_to_statsd=False,
+    )
+    def upload_enabled(self) -> Response:
+        """Returns a boolean saying whether uploads are enabled for the user
+        ---
+        get:
+          description:
+            Get the status of if any databases have allow file upload enabled
+            and also have a schema in a database that can have files uploaded to it.
+          responses:
+            200:
+              description: Database names
+              content:
+                application/json:
+                  schema:
+                    type: boolean
+            400:
+              $ref: '#/components/responses/400'
+            500:
+              $ref: '#/components/responses/500'
+        """
+        dbs_with_uploads = (
+            db.session.query(Database).filter_by(allow_file_upload=True).all()

Review comment:
       What happens if the ORM query fails? Can we add try catch to manage what we'd return to the user?




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