Skip to content

Commit

Permalink
Merge pull request #1433 from dandi/enh-delete-msg
Browse files Browse the repository at this point in the history
  • Loading branch information
danlamanna authored Jan 17, 2023
2 parents c95f008 + 08b9257 commit e6bda73
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions dandiapi/api/services/dandiset/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ def create_dandiset(


def delete_dandiset(*, user, dandiset: Dandiset) -> None:
if (
not user.has_perm('owner', dandiset)
or dandiset.embargo_status != Dandiset.EmbargoStatus.OPEN
):
raise NotAllowed()

if not user.has_perm('owner', dandiset):
raise NotAllowed('Cannot delete dandisets which you do not own.')
if dandiset.embargo_status != Dandiset.EmbargoStatus.OPEN:
raise NotAllowed('Cannot delete dandisets which are embargoed.')
if dandiset.versions.exclude(version='draft').exists():
raise NotAllowed('Cannot delete dandisets with published versions.')
if dandiset.versions.filter(status=Version.Status.PUBLISHING).exists():
Expand Down

0 comments on commit e6bda73

Please sign in to comment.