villebro commented on a change in pull request #10578:
URL:
https://github.com/apache/incubator-superset/pull/10578#discussion_r469779320
##########
File path: superset/datasets/commands/delete.py
##########
@@ -46,10 +46,22 @@ def __init__(self, user: User, model_id: int):
def run(self) -> Model:
self.validate()
try:
- dataset = DatasetDAO.delete(self._model, commit=False)
- security_manager.del_permission_view_menu(
- "datasource_access", dataset.get_perm()
+ view_menu = (
+ security_manager.find_view_menu(self._model.get_perm())
+ if self._model
+ else None
+ )
+ permission_views = (
+ db.session.query(security_manager.permissionview_model)
+ .filter_by(view_menu=view_menu)
+ .all()
Review comment:
The fact that we have to keep mypy happy here with the `if self_model
else None` makes this look misleading when issuing the
`.filter_by(view_menu=view_menu)`. Just a good reminder to keep use of
`Optional[]` to a minimum whenever possible.
----------------------------------------------------------------
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]