From b66f47df01efa7a58a961ce97253ecf3b69d6911 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Fri, 17 Apr 2009 20:47:25 +0000 Subject: [PATCH] fixed #10213: RssFeed aspect now checks canView and gives HTTP Basic Auth login box --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/AssetAspect/RssFeed.pm | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 857aaf0b4..a291ea283 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -27,6 +27,7 @@ - rfe: #10073: Account system to be able to return XML/JSON (perlDreamer Consulting) - Replaced the tax system with a pluggable one. Included are a Generic plugin (which works the same as the old system) and a plugin for EU merchants ( Martin Kamerbeek / Oqapi ) + - fixed #10213: RssFeed aspect now checks canView and gives HTTP Basic Auth box to login 7.7.3 - fixed #10094: double explanation in thread help diff --git a/lib/WebGUI/AssetAspect/RssFeed.pm b/lib/WebGUI/AssetAspect/RssFeed.pm index badc52165..bbb3396b4 100644 --- a/lib/WebGUI/AssetAspect/RssFeed.pm +++ b/lib/WebGUI/AssetAspect/RssFeed.pm @@ -143,6 +143,24 @@ sub definition { #------------------------------------------------------------------- +=head2 _httpBasicLogin ( ) + +Set header values and content to show the HTTP Basic Auth login box. + +=cut + +sub _httpBasicLogin { + my ( $self ) = @_; + $self->session->request->headers_out->set( + 'WWW-Authenticate' => 'Basic realm="'.$self->session->setting->get('companyName').'"' + ); + $self->session->http->setStatus(401,'Unauthorized'); + $self->session->http->sendHeader; + return ''; +} + +#------------------------------------------------------------------- + =head2 exportAssetCollateral () Extended from WebGUI::Asset and exports the www_viewRss() and @@ -494,6 +512,7 @@ Return Atom view of the syndicated items. sub www_viewAtom { my $self = shift; + return $self->_httpBasicLogin unless $self->canView; $self->session->http->setMimeType('application/atom+xml'); return $self->getFeed( XML::FeedPP::Atom->new )->to_string; } @@ -508,6 +527,7 @@ Return Rdf view of the syndicated items. sub www_viewRdf { my $self = shift; + return $self->_httpBasicLogin unless $self->canView; $self->session->http->setMimeType('application/rdf+xml'); return $self->getFeed( XML::FeedPP::RDF->new )->to_string; } @@ -522,6 +542,7 @@ Return RSS view of the syndicated items. sub www_viewRss { my $self = shift; + return $self->_httpBasicLogin unless $self->canView; $self->session->http->setMimeType('application/rss+xml'); return $self->getFeed( XML::FeedPP::RSS->new )->to_string; }