silverstripe / silverstripe-versioned

Versioning for Silverstripe model
BSD 3-Clause "New" or "Revised" License
8 stars 34 forks source link

Remove `canArchive()` method for CMS 6 #447

Closed GuySartorelli closed 3 months ago

GuySartorelli commented 6 months ago

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

Acceptance criteria

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.