Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove canArchive() method for CMS 6 #447

Closed
3 tasks done
GuySartorelli opened this issue May 27, 2024 · 0 comments
Closed
3 tasks done

Remove canArchive() method for CMS 6 #447

GuySartorelli opened this issue May 27, 2024 · 0 comments
Assignees
Milestone

Comments

@GuySartorelli
Copy link
Member

GuySartorelli commented May 27, 2024

When calling delete() on a record (without changing what versioned state you're operating in), the record actually ends up being archived. While it is more correct to call doArchive() instead of delete() if you intend to archive the record, it's not uncommon to just call delete() directly.

Because of this, it's easy to call canDelete() as the permission check before archiving a record, forgetting that there's a specific canArchive() method that should be called instead.

This has lead to at least one issue in the past.

We should consider whether to remove the canArchive() permission method, and just assume that canDelete() is always canArchive().

Note

  • DataObject::delete() and Versioned::doArchive() methods are not being changed

Acceptance criteria

  • canArchive() method is deprecated in CMS 5
  • canArchive() method is deleted in CMS 6
  • Code in updated to use canDelete() in CMS 6

CMS 5 PRs

CMS 6 PRs

Important

Don't merge these until the CMS 5 PRs have been merged and merged up.
If there are merge conflicts (which there almost 100% will be) reassign to Guy to resolve.

@GuySartorelli GuySartorelli added this to the Silverstripe CMS 6 milestone May 27, 2024
@GuySartorelli GuySartorelli changed the title Consider removing canArchive() method for CMS 6 Remove canArchive() method for CMS 6 Aug 12, 2024
@GuySartorelli GuySartorelli self-assigned this Aug 13, 2024
@GuySartorelli GuySartorelli removed their assignment Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants