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.
This commit is contained in:
Colin Kuskie 2007-01-26 05:45:56 +00:00
parent ae2c99beb5
commit 0eba64bc52
4 changed files with 17 additions and 4 deletions

View file

@ -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');