Publish / Unpublish

Last modified by Vincent Massol on 2021/03/17 21:42

cogConfigure publish and unpublish dates on documents. Unpublished documents are only visible to user which have edit rights.
TypeAuthenticator
Category
Developed by

Edo Beutler, Fabian Pichler

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

This extension allows you to add a Classes.DocumentPublication object to a document and set a publish and / or unpublish date. Setting publish and unpublish dates restricts the view rights for visitors without edit rights. If you don't have edit rights you will be redirected to the login. Multiple publication timespans (objects) on a document are possible.
Empty date fields are seen as 'no date set', so you are able to set only a publish and no unpublish date for a document.

A little example:
You create the document Event.Registration with an object of class Classes.DocumentPublication with publishDate='01.08.2013 12:00' and unpublishDate='31.08.2013 18:00'. In that timespan all visitors can access the document. Before and after that time you need edit rights on Event.Registration to view the page.

Technical details (and warning):
In the current (first) version the extension there is a performance penalty because the security cache is not taken into account for documents with a publication object.

Here is a little example. This page just prints out the date and the user.
editwiki.png

An object is added and the dates are set.
editobj.png

And this is how the page will be displayed for different users on different times.
result.png

Prerequisites & Installation Instructions

Set security.authorization.settler=celpublication in xwiki.properties and add the jar file to the lib folder.

Add a boolean field 'publishdate_active' to XWiki.XWikiPreferences to activate the extension (or add celements.publishdate.active=1 to your config).

Create the class 'Classes.DocumentPublication' with the two date fields 'publishDate' and 'unpublishDate'. Hint: don't set unpublish as "empty is today" or you can't leave it empty.

Tags:
    

Get Connected