[Bps-public-commit] rt-extension-assets branch, 1.0/selfservice-links, created. 1.0rc1-2-g1b43ad3

Kevin Falcone falcone at bestpractical.com
Fri Feb 14 17:11:21 EST 2014


The branch, 1.0/selfservice-links has been created
        at  1b43ad368cf7e17b0aa0107f5812dd6eedb436df (commit)

- Log -----------------------------------------------------------------
commit df8b1f1084506cf0e10665e169e2ec3000ffb2cd
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Feb 14 16:57:34 2014 -0500

    Link to the SelfService asset page when rendered on SelfService/Display.html
    
    Giving Unprivileged users a link to /Asset/Display.html fails.

diff --git a/html/Ticket/Elements/ShowAssets b/html/Ticket/Elements/ShowAssets
index 945407a..27a00d5 100644
--- a/html/Ticket/Elements/ShowAssets
+++ b/html/Ticket/Elements/ShowAssets
@@ -116,8 +116,9 @@ $m->callback(
 % $m->callback( CallbackName => "Start", Ticket => $Ticket, Assets => $assets );
 
 <div id="assets-accordion" class="rt-accordion">
+% my $display_path = $session{'CurrentUser'}->Privileged ? 'Asset' : 'SelfService/Asset';
 % while (my $asset = $assets->Next) {
-  <h3><a href="<% RT->Config->Get('WebPath') %>/Asset/Display.html?id=<% $asset->id %>"><&|/l, $asset->id, $asset->Name &>#[_1]: [_2]</&></a>
+  <h3><a href="<% RT->Config->Get('WebPath') %>/<% $display_path %>/Display.html?id=<% $asset->id %>"><&|/l, $asset->id, $asset->Name &>#[_1]: [_2]</&></a>
 <%perl>
 if ($Ticket->CurrentUserHasRight("ModifyTicket")) {
     my $targets = $asset->Links("Target")->Clone;

commit 1b43ad368cf7e17b0aa0107f5812dd6eedb436df
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Feb 14 17:08:24 2014 -0500

    Make asset links target SelfService for Unprivileged users
    
    In particular, this shows up in Ticket History on
    /SelfService/Display.html

diff --git a/lib/RT/URI/asset.pm b/lib/RT/URI/asset.pm
index 06d880a..aeab115 100644
--- a/lib/RT/URI/asset.pm
+++ b/lib/RT/URI/asset.pm
@@ -181,6 +181,7 @@ sub HREF {
     my $self = shift;
     if ($self->IsLocal and $self->Object) {
         return RT->Config->Get('WebURL')
+             . ( $self->CurrentUser->Privileged ? "" : "SelfService/" )
              . "Asset/Display.html?id="
              . $self->Object->Id;
     } else {

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list