From 0eba64bc52f1a2231c78bbbe7b5ce07fb3ee68ce Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 26 Jan 2007 05:45:56 +0000 Subject: [PATCH] Session->Privilege is not design well to work in embedded applications like the RTE because by default it uses the default user style from settings. This renders a full page, when we really need a message. I've added an argument to session->privilege->insufficient to use the empty style and to use a different message with no embedded macros to process for logging in. I tested this on the RTE folder adder and it works fine. I duplicated this work in the Image add/edit save routine as well. Since privilege->insuffient didn't take arguments before, this preserves the existing API, which is broken. --- docs/changelog/7.x.x.txt | 3 ++- lib/WebGUI/Operation/FormHelpers.pm | 4 ++-- lib/WebGUI/Session/Privilege.pm | 9 ++++++++- lib/WebGUI/i18n/English/WebGUI.pm | 5 +++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index d5ccc97e3..b5f608624 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -3,11 +3,12 @@ - Added a attachment_thumbnail option to the CS RSS feed. - fix: No closure - fix: content in packages made from page layout don't include content - - No Reports In/Out Board (perlDreamer Consulting, LLC) + - fix: No Reports In/Out Board (perlDreamer Consulting, LLC) - fix: The 7.2.3-7.3.0 upgrade will no longer orphan EventsCalendars and Events on the clipboard. - fix: The upgrade script will remove any orphaned EventsCalendars and Events. + - fix: Media Folder (perlDreamer Consulting, LLC) 7.3.7 diff --git a/lib/WebGUI/Operation/FormHelpers.pm b/lib/WebGUI/Operation/FormHelpers.pm index ca27d839e..28fe01a00 100644 --- a/lib/WebGUI/Operation/FormHelpers.pm +++ b/lib/WebGUI/Operation/FormHelpers.pm @@ -373,7 +373,7 @@ sub www_richEditAddFolderSave { # get base url my $base = WebGUI::Asset->newByUrl($session) || WebGUI::Asset->getRoot($session); # check if user can edit the current asset - return $session->privilege->insufficient() unless $base->canEdit; + return $session->privilege->insufficient('bare') unless $base->canEdit; my $filename = $session->form->process('filename') || 'untitled'; $base->addChild({ @@ -458,7 +458,7 @@ sub www_richEditAddImageSave { #my $base = $session->asset; my $url = $base->getUrl; # check if user can edit the current asset - return $session->privilege->insufficient() unless $base->canEdit; + return $session->privilege->insufficient('bare') unless $base->canEdit; my $storage = WebGUI::Storage::Image->create($session); my $filename = $storage->addFileFromFormPost('filename'); diff --git a/lib/WebGUI/Session/Privilege.pm b/lib/WebGUI/Session/Privilege.pm index b6100285d..227e262e0 100644 --- a/lib/WebGUI/Session/Privilege.pm +++ b/lib/WebGUI/Session/Privilege.pm @@ -88,10 +88,17 @@ Returns a message stating that the user does not have the required privileges to sub insufficient { my $self = shift; + my $noStyle = shift; my $i18n = WebGUI::International->new($self->session); $self->session->http->setStatus("401", "Insufficient Privileges"); my $output = '

'.$i18n->get(37).'

'; - $output .= $i18n->get(38); + if ($noStyle) { + $self->session->style->useEmptyStyle(1); + $output .= $i18n->get('bare insufficient'); + } + else { + $output .= $i18n->get(38); + } return $self->session->style->userStyle($output); } diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm index 3fead477a..f37d71179 100644 --- a/lib/WebGUI/i18n/English/WebGUI.pm +++ b/lib/WebGUI/i18n/English/WebGUI.pm @@ -3288,6 +3288,11 @@ that Asset and all Assets below it.

lastUpdated => 1031514049 }, + 'bare insufficient' => { + message => q|You do not have sufficient privileges to perform this operation. Please log in with an account that has sufficient privileges before attempting this operation.|, + lastUpdated => 1169790230 + }, + '164' => { message => q|Authentication Method|, lastUpdated => 1031514049