Skip to content

Commit

Permalink
Merge pull request #268 from PlaidCloud/dashboard-owners-should-be-ch…
Browse files Browse the repository at this point in the history
…art-owners

Dashboard owners should be chart owners
  • Loading branch information
inviscid authored Apr 29, 2024
2 parents 6e0870b + 43d33cf commit 70423e4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plaid/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ def can_access_datasource(self, datasource: "BaseDatasource") -> bool:
return bool(project.get('id'))


def is_owner(self, resource: Model) -> bool:
from superset.models.slice import Slice # a Slice is a chart
if isinstance(resource, Slice):
return super().is_owner(resource) or any([self.is_owner(dashboard) for dashboard in resource.dashboards])

return super().is_owner(resource)


# def get_project_ids(self):
# log.info(f"About to fetch user project ids")
# from superset.models.core import Database
Expand Down

0 comments on commit 70423e4

Please sign in to comment.