Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(datasets): add support for removing owners #16461

Merged
merged 2 commits into from
Aug 31, 2021

Conversation

villebro
Copy link
Member

@villebro villebro commented Aug 26, 2021

SUMMARY

Currently removing all owners from the datasets modal raises the following error:
image

This makes the following changes to the endpoint:

  • When OLD_API_CHECK_DATASET_OWNERSHIP config is set to the default value (True), we both check ownership and make sure the user doesn't lock themselves out of the object. See feat(dao): admin can remove self from object owners #15149 for more details on how this works for Admin vs regular users
  • When the OLD_API_CHECK_DATASET_OWNERSHIP config flag is set to False, the behavior is unchanged (other than fixing the error when datasource_dict["owners"] == None). Note that in this scenario, a user is able to both edit datasets that they don't own and also save without adding themselves to the list of owners. See fix(datasets): add support for removing owners #16461 for context on this FF.

AFTER

image

TESTING INSTRUCTIONS

  1. Login as Admin
  2. Open the dataset modal for a dataset you own
  3. Remove yourself as owner
  4. See the error

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@codecov
Copy link

codecov bot commented Aug 26, 2021

Codecov Report

Merging #16461 (88c305a) into master (62d8ab7) will decrease coverage by 0.05%.
The diff coverage is 50.00%.

❗ Current head 88c305a differs from pull request most recent head 1c6b699. Consider uploading reports for the commit 1c6b699 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16461      +/-   ##
==========================================
- Coverage   76.63%   76.58%   -0.06%     
==========================================
  Files        1002     1002              
  Lines       53680    53684       +4     
  Branches     6852     6852              
==========================================
- Hits        41138    41112      -26     
- Misses      12305    12335      +30     
  Partials      237      237              
Flag Coverage Δ
hive ?
mysql 81.48% <50.00%> (-0.01%) ⬇️
postgres 81.50% <50.00%> (-0.05%) ⬇️
presto 81.34% <50.00%> (?)
python 81.81% <50.00%> (-0.11%) ⬇️
sqlite 81.19% <50.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/views/datasource/views.py 90.10% <50.00%> (-1.85%) ⬇️
superset/db_engines/hive.py 0.00% <0.00%> (-82.15%) ⬇️
superset/db_engine_specs/hive.py 69.80% <0.00%> (-16.87%) ⬇️
superset/utils/core.py 89.76% <0.00%> (-0.13%) ⬇️
superset/models/core.py 89.40% <0.00%> (+0.25%) ⬆️
superset/connectors/sqla/models.py 89.46% <0.00%> (+1.18%) ⬆️
superset/db_engine_specs/presto.py 90.37% <0.00%> (+5.85%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 62d8ab7...1c6b699. Read the comment docs.

@zhaoyongjie
Copy link
Member

Code LGTM, a little concern if we have to avoid users to removing all owners ?

@villebro villebro force-pushed the villebro/dataset-no-owners branch 2 times, most recently from f1299f7 to f61d977 Compare August 27, 2021 06:08
@amitmiran137 amitmiran137 reopened this Aug 29, 2021
@jinghua-qa
Copy link
Member

🏷 2021.34

Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhaoyongjie zhaoyongjie merged commit c5a5cf7 into apache:master Aug 31, 2021
stevenuray pushed a commit to preset-io/superset that referenced this pull request Aug 31, 2021
* fix(datasets): add support for removing owners

* default to current user

(cherry picked from commit c5a5cf7)
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
* fix(datasets): add support for removing owners

* default to current user
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 28, 2021
* fix(datasets): add support for removing owners

* default to current user
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.4.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset:2021.34 preset-io size/S 🚢 1.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants