suddjian opened a new pull request #14626:
URL: https://github.com/apache/superset/pull/14626


   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   
   This fixes a case where users who were not owners of a dashboard were 
incorrectly seeing the "Edit" button. This is not a security hole as the users 
cannot successfully submit their edits, but it was incorrect UI that needed to 
be fixed.
   
   The frontend was incorrectly inferring dashboard edit permissions. This 
copies functionality from the backend's 
[check_ownership](https://github.com/apache/superset/blob/d31958cbd2e980a5c186334e718fa71ed8d12e74/superset/views/base.py#L569)
 function. 
   
   The frontend version is much simpler than the backend version due to being a 
pure function, dashboard-specific, and not having parameterized function 
behavior, but it implements the same checks as the backend version.
   
   I did this instead of changing endpoints, because the caching of the 
existing dashboard endpoints depends on returning the same data to all users, 
and because implementing a new endpoint to just return a boolean felt wrong.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   ### TEST PLAN
   <!--- What steps should be taken to verify the changes -->
   
   Wrote unit tests, tested functionality manually.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] 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.

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to