From a7976f72564378c429a6a1dfdb4fcf41258bd905 Mon Sep 17 00:00:00 2001 From: Roy Johnson Date: Fri, 5 Jan 2007 22:57:39 +0000 Subject: [PATCH] fix - Cannot add new page to the Wiki --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Wobject/WikiMaster.pm | 28 +++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index f8828f898..a61f4d545 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -3,6 +3,7 @@ - fix: Daily recurring payment reports should now be sent to the configured "commerceSendDailyReportTo" address. - fix: Closed Posts Displaying in CS + - fix: Cannot add new page to the Wiki 7.3.3 - fix: Wiki Purge throws fatal diff --git a/lib/WebGUI/Asset/Wobject/WikiMaster.pm b/lib/WebGUI/Asset/Wobject/WikiMaster.pm index 298471be4..17b72dadc 100644 --- a/lib/WebGUI/Asset/Wobject/WikiMaster.pm +++ b/lib/WebGUI/Asset/Wobject/WikiMaster.pm @@ -112,7 +112,33 @@ sub autolinkHtml { #------------------------------------------------------------------- sub canAdminister { my $self = shift; - return $self->session->user->isInGroup($self->get('groupToAdminister')) || $self->canEdit; + return $self->session->user->isInGroup($self->get('groupToAdminister')) || $self->SUPER::canEdit; +} + +#------------------------------------------------------------------- + +=head2 canEdit ( ) + +Overriding canEdit method to check permissions correctly when someone is adding a wikipage + +=cut + +sub canEdit { + my $self = shift; + return ( + ( + ( + $self->session->form->process("func") eq "add" || + ( + $self->session->form->process("assetId") eq "new" && + $self->session->form->process("func") eq "editSave" && + $self->session->form->process("class") eq "WebGUI::Asset::WikiPage" + ) + ) && + $self->canEditPages + ) || # account for new posts + $self->SUPER::canEdit() + ); } #-------------------------------------------------------------------