Versioning¶
Versioning lets editors snapshot the current state of a content object and later inspect or restore an earlier snapshot. It reuses the staging machinery (see Staging (Working Copies)): a version is essentially a frozen working copy of the content kept in a dedicated, hidden container.
Overview¶
Versioning is available on content that has the Webcloud7 Versioning support behavior enabled. For such content:
Editors can create a new version, which stores a full snapshot of the content (including its Simplelayout blocks and internal links).
Up to 10 versions are kept per object. When the limit is reached, creating a new version automatically removes the oldest one.
Each version records who created it, when, and an optional comment.
An earlier version can be restored back onto the live object. Restoring adds a “Restored from Version” entry to the object’s review history (see Website Workflow).
Versions are stored in a site-wide container (cms_versions_container). Inside it,
each versioned object gets its own ObjectVersions sub-container holding that
object’s snapshots. These containers are excluded from navigation and cannot be
moved or copied.
Access control¶
Two permissions gate versioning:
wcs.backend Versioning: Access versions — required to list and view versions.
wcs.backend Versioning: Create versions — required to create, delete, and restore versions.
Access to a stored version is additionally checked against the original
object: a user may only see a version if they are allowed to access versions on the
content it was taken from. Attempts to reach a version without that permission
result in a 404 Not Found.
Browsing versions¶
The list of versions for an object is rendered by the list_versions view on the
content.
GET /Plone/my-page/list_versions HTTP/1.1
Host: localhost:8080
The listing shows, per version, the author’s full name, the localized creation time, and the recorded comment, together with the actions to view, restore, or delete that version.
Inspecting a single version¶
The display_version view renders the stored snapshot of one version so it can be
previewed without affecting the live object. Versions are addressed by their index
(0 is the oldest kept version).
GET /Plone/my-page/display_version?version_id=0 HTTP/1.1
Host: localhost:8080
The response renders the content body of that historical snapshot.
Creating a version¶
A new snapshot is created by posting to the create_version view on the content.
This requires the create versions permission. When the per-object limit of 10 is
already reached, the oldest version is dropped to make room.
POST /Plone/my-page/create_version HTTP/1.1
Host: localhost:8080
After creation the user is returned to the version listing.
Restoring a version¶
Posting to restore_version with a version_id copies the selected snapshot back
onto the live object, rewriting internal links and Simplelayout block references so
the restored content is consistent. A “Restored from Version” entry is appended to
the object’s review history.
POST /Plone/my-page/restore_version HTTP/1.1
Host: localhost:8080
Content-Type: application/x-www-form-urlencoded
version_id=0
After restoring, the user is returned to the live object.
Deleting a version¶
Posting to delete_version with a version_id permanently removes a single stored
snapshot.
POST /Plone/my-page/delete_version HTTP/1.1
Host: localhost:8080
Content-Type: application/x-www-form-urlencoded
version_id=0
Note
Version indices are positional within the kept snapshots. Because the oldest version is dropped once the limit of 10 is exceeded, an index refers to “the n-th currently kept version”, not to a stable identifier.