I need to block the change history (from the tools menu) for anonymous users. Is there a way to do this?
Hi Katherine,
Unfortunately, from my thoughts Confluence doesn't work with this Feature, since you block anonymous to view a page, you will block him to see all content, you are not able just to block the history of the page. However, if you wish, we can create a Feature Request for you and see how it will goes.
Thanks a lot for your comprehension.
Kind Regards,
Giuliano Tenedini
Hello Katherine,
Intrigued by your request I have made a workaround using Velocity in order to avoid this to happen. We will need to modify the viewpreviousversion.vm from <confluence-install>/confluence/pages/ you can save a copy and edit all the content to the code below. Please change the custom message on the last lines accordingly to your needs as well.
<html> <head> <title>$action.getText("title.view.previous.versions") - $!page.title</title> </head> #applyDecorator("root") #decoratorParam("helper" $action.helper) #decoratorParam("mode" "view-information") #decoratorParam("calendar-width" "200px") #decoratorParam("context" "$action.page.type") ## PERMISSION TO CHECK IF USER IS ANONYMOUS, IF ANONYMOUS THERE IS NO HISTORY FOR IT #if ($action.remoteUser != $null) #requireResource("confluence.web.resources:page-history") <form name="diff" method="GET" action="diffpagesbyversion.action"> <input type="submit" value="$action.getText('compare.selected')"> <input type="hidden" name="pageId" value="$action.pageId"> <style> .tableview td {white-space:nowrap; vertical-align:top;} </style> <table id="page-history-container" width="100%" cellspacing="0" class="tableview"> <tr> <th>&nbsp;</th> <th>$action.getText("heading.version.number")</th> <th>$action.getText("heading.version.date")</th> <th>$action.getText("heading.comment")</th> #if( $action.isRevertPermitted()) <th>$action.getText("heading.operations")</th> #end </tr> <tr id="rowForVersion$page.version"> <td width="%1"><input type="checkbox" name="selectedPageVersions" value="$page.version" #if ($action.isSelectedVersion($page.version)) checked #end></td> <td align="left"> <strong> <a href="viewpage.action?pageId=$page.id">$action.getText("current.version")</a> (v. $page.version) </strong> </td> <td align="middle"> <strong> $dateFormatter.formatDateTime($page.lastModificationDate) </strong> </td> <td style="white-space:normal;"> <strong>#usernameLink ($page.lastModifierName)</strong>#if ($page.versionCommentAvailable): <br><span class="change-comment">$page.renderedVersionComment</span>#end ## Only put in a break if there's a comment </td> #if( $action.isRevertPermitted()) <td>&nbsp;</td> #end </tr> #if( $previousVersions ) #foreach( $oldPage in $previousVersions ) <tr id="rowForVersion$oldPage.version"> <td width="%1"><input type="checkbox" name="selectedPageVersions" value="$oldPage.version" #if ($action.isSelectedVersion($oldPage.version)) checked #end></td> <td align="left"> <a href="viewpage.action?pageId=${oldPage.id}">v. $oldPage.version</a> </td> <td align="middle"> $dateFormatter.formatDateTime( $oldPage.lastModificationDate ) </td> <td style="white-space:normal;"> <strong>#usernameLink ($oldPage.lastModifierName)</strong>#if ($oldPage.versionCommentAvailable): <br><span class="change-comment">($oldPage.renderedVersionComment)</span>#end ## Only put in a break if there's a comment </td> #if( $action.isRevertPermitted()) <td align="middle"> #if ($oldPage.version>0) <a href="revertpagebacktoversion.action?pageId=$page.id&version=${oldPage.version}">$action.getText("restore.this.version")</a> #end </td> #end </tr> #end #end </table> </form> <p><a href="${req.contextPath}/pages/viewinfo.action?pageId=${page.id}">$action.getText('return.to.page.info')</a></p> #else ## CUSTOM MESSAGE TO ANONYMOUS USER <ul>Unfortunately as Anonymous you lack permission to use the page History, for further information please contact Confluence Administrators</ul> #end #end </html>
Hope this helps you get on the right track. If you need any tweak let me know!Cheers,Guilherme
Hi Guilherme,
Does this solution still works for Confluence server 5.9.9https://confluence.atlassian.com/confkb/how-do-i-prevent-anonymous-users-from-using-page-history-317196367.html ?
It looks like you're new here. Sign in or register to get started.