superset: Admin can not overwrite chart from another owner

When an Admin opens a chart which is owned by a different user, the Admin can not save and overwrite the existing chart

How to reproduce the bug

  1. Login as Admin
  2. Open an existing chart owned by another user
  3. Click on Save

Expected results

Admin can choose to overwrite the chart

Actual results

The Overwrite option is disabled

Screenshots

image

Environment

  • superset version: 2.1.0
  • python version: python --version
  • node.js version: node -v
  • any feature flags active: FEATURE_FLAGS = { “DASHBOARD_NATIVE_FILTERS”: True, “THUMBNAILS”: False, “LISTVIEWS_DEFAULT_CARD_VIEW” : False, “THUMBNAILS_SQLA_LISTENERS”: False, “ENABLE_EXPLORE_DRAG_AND_DROP”: True, “ENABLE_TEMPLATE_PROCESSING”: True, “DASHBOARD_CROSS_FILTERS”: True, “GENERIC_CHART_AXES”: True, “ENABLE_DND_WITH_CLICK_UX”: True, “UX_BETA”: True, “ALERT_REPORTS”: True, “DASHBOARD_RBAC”: True, “ALLOW_ADHOC_SUBQUERY” : True, “HORIZONTAL_FILTER_BAR”: True, }

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven’t found one similar.

Additional context

Add any other context about the problem here.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 8
  • Comments: 16 (7 by maintainers)

Most upvoted comments

@MasudOsmanmr9 This workaround has already been mentioned and it is what the issue is, not the solution. As an admin, I should not be restricted from any operation. Unfortunately, this issue still exists in version 4.1.1.

@eschutho Still exists in 3.0

@rusackas Yes it still exists in version 4.0.0

any user can access any user’s dataset and chart. actually super set created it in permisssion access architecture,

if you go to cahrts page where all chart are listed

image

image

u will see there there is owners column where it shows which owner have access on this chart, onlu those user can overwrite it!

so in chart page at last column you can see actions

image

if u hover on that column there will an edit button will be shown for every chart individually , if u click that button a pop will come out where u will find an access filed there you can set which user can also edit this charts

image

same things u can do with datasets

As a workaround you can create a database trigger which will automatically give all admins ownership of newly created charts:

CREATE TRIGGER add_admin_role AFTER INSERT ON slices
FOR EACH ROW
  INSERT INTO slice_user(user_id, slice_id)
  SELECT user_id, NEW.id FROM ab_user_role
    WHERE role_id=(SELECT id FROM ab_role WHERE name='Admin') AND
    user_id != NEW.created_by_fk;

And you can give admins ownership of existing charts by running this query for each admin user id (replacing <user_id> with the user_id):

INSERT INTO slice_user (user_id, slice_id)
SELECT distinct <user_id>, slice_id FROM slice_user
WHERE slice_id NOT IN
  (SELECT slice_id FROM slice_user WHERE user_id=<user_id>)
  AND slice_id IN (SELECT id FROM slices);

Hope this helps.