X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FNoAuth%2Frss%2Fdhandler;h=46b542537b174b3f6e5ae3e42b7e26b8e9877909;hp=b8057e730746ba3ca45facc8066a10c8a8abb440;hb=44dd00a3ff974a17999e86e64488e996edc71e3c;hpb=3d0a1bb06b895c5be6e3f0517d355442a6b1e125 diff --git a/rt/share/html/NoAuth/rss/dhandler b/rt/share/html/NoAuth/rss/dhandler index b8057e730..46b542537 100644 --- a/rt/share/html/NoAuth/rss/dhandler +++ b/rt/share/html/NoAuth/rss/dhandler @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2019 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -45,4 +45,37 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -<& /Search/Elements/ResultsRSSView, %ARGS &> +<%init> +my $path = $m->dhandler_arg; + +my $notfound = sub { + my $mesg = shift; + $r->headers_out->{'Status'} = '404 Not Found'; + $RT::Logger->info("Error encountered in rss generation: $mesg"); + $m->clear_and_abort; +}; + +$notfound->("Invalid path: $path") unless $path =~ m!^([^/]+)/([^/]+)/?!; + +my ( $name, $auth ) = ( $1, $2 ); + +# Unescape parts +$name =~ s/\%([0-9a-z]{2})/chr(hex($1))/gei; + +# convert to perl strings +$name = Encode::decode( "UTF-8", $name); + +my $user = RT::User->new(RT->SystemUser); +$user->Load($name); +$notfound->("Invalid user: $user") unless $user->id; + +$notfound->("Invalid authstring") + unless $user->ValidateAuthString( $auth, + $ARGS{Query} . $ARGS{Order} . $ARGS{OrderBy} ); + +my $cu = RT::CurrentUser->new; +$cu->Load($user); +local $session{'CurrentUser'} = $cu; + +$m->comp("/Search/Elements/ResultsRSSView", %ARGS); +