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 2020/02/26 23:14:39 UTC

[GitHub] [incubator-superset] sb2nov opened a new issue #9214: Allow admins to edit any chart

sb2nov opened a new issue #9214: Allow admins to edit any chart
URL: https://github.com/apache/incubator-superset/issues/9214
 
 
   We've someone in the organization that created a chart and added it to a dashboard. As an admin I don't have permissions by default to overwrite this chart. 
   
   Is there a way to give admins ability to edit any chart ? 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-superset] henry145145 commented on issue #9214: Allow admins to edit any chart

Posted by GitBox <gi...@apache.org>.
henry145145 commented on issue #9214: Allow admins to edit any chart
URL: https://github.com/apache/incubator-superset/issues/9214#issuecomment-597779461
 
 
   can try to look into "@expose("/explore/<datasource_type>/<datasource_id>/", methods=["GET", "POST"])" in `views/core.py `.  You can customize your "can_overwrite" here
   
   ref: https://github.com/apache/incubator-superset/blob/master/superset/views/core.py
   
   comment out line 861 to 865
   ```
   if action == "overwrite" and not slice_overwrite_perm:
               return json_error_response(
                   _("You don't have the rights to ") + _("alter this ") + _("chart"),
                   status=400,
               )
   ```
   add something at line 888 and change the bootstrap little bit
   ```
   user_role_s = [role.name.lower() for role in list(get_user_roles())]
   can_ow = True if "admin" in user_role_s else slice_overwrite_perm
   bootstrap_data = {
               "can_add": slice_add_perm,
               "can_download": slice_download_perm,
               "can_overwrite": can_ow,
               "datasource": datasource.data,
               "form_data": form_data,
               "datasource_id": datasource_id,
               "datasource_type": datasource_type,
               "slice": slc.data if slc else None,
               "standalone": standalone,
               "user_id": user_id,
               "forced_height": request.args.get("height"),
               "common": common_bootstrap_payload(),
           }
   ```
   then, inside def save_or_overwrite_slice, right before the response (line 1030) can add something like
   ```
           user_role_s = [role.name.lower() for role in list(get_user_roles())]
           can_ow = True if "admin" in user_role_s else slice_overwrite_perm
   
           response = {
               "can_add": slice_add_perm,
               "can_download": slice_download_perm,
               "can_overwrite": can_ow,
               "form_data": slc.form_data,
               "slice": slc.data,
               "dashboard_id": dash.id if dash else None,
           }
   ```
   Hope this help
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [incubator-superset] stale[bot] closed issue #9214: Allow admins to edit any chart

Posted by GitBox <gi...@apache.org>.
stale[bot] closed issue #9214:
URL: https://github.com/apache/incubator-superset/issues/9214


   


----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [incubator-superset] stale[bot] commented on issue #9214: Allow admins to edit any chart

Posted by GitBox <gi...@apache.org>.
stale[bot] commented on issue #9214:
URL: https://github.com/apache/incubator-superset/issues/9214#issuecomment-626371139


   This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue `.pinned` to prevent stale bot from closing the issue.
   


----------------------------------------------------------------
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:
users@infra.apache.org



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