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

Alex Vandiver alexmv at bestpractical.com
Wed Feb 19 13:44:25 EST 2014


The branch, 1.0/selfservice-links has been created
        at  0b7d3d60413fc1baf45454a9f95317e1b16a754d (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 {

commit 238ed48e57bbf4a24c5a3e7a4500be9947c9e46e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Feb 19 13:32:18 2014 -0500

    Hide "Add an asset" box unless the user has ModifyTicket

diff --git a/html/Ticket/Elements/ShowAssets b/html/Ticket/Elements/ShowAssets
index 27a00d5..ac32c66 100644
--- a/html/Ticket/Elements/ShowAssets
+++ b/html/Ticket/Elements/ShowAssets
@@ -187,6 +187,7 @@ if ($ShowRelatedTickets) {
 % }
 </div>
 
+% if ($Ticket->CurrentUserHasRight("ModifyTicket")) {
   <div class="add-asset">
     <label>
       <&|/l&>Add an asset to this ticket</&>
@@ -194,6 +195,7 @@ if ($ShowRelatedTickets) {
     </label>
     <input type="submit" value="+">
   </div>
+% }
 
 % $m->callback( CallbackName => "End", Ticket => $Ticket, Assets => $assets );
 

commit 0b7d3d60413fc1baf45454a9f95317e1b16a754d
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Feb 19 13:37:32 2014 -0500

    Don't link to asset Modify pages if the user only has SelfService

diff --git a/html/Asset/Elements/ShowSummary b/html/Asset/Elements/ShowSummary
index be39e65..ebfe7f3 100644
--- a/html/Asset/Elements/ShowSummary
+++ b/html/Asset/Elements/ShowSummary
@@ -56,6 +56,9 @@ my @sections = (
     "Links",    #loc
 );
 
+my $can_edit = $session{CurrentUser}->Privileged
+    && $AssetObj->CurrentUserHasRight("ModifyAsset");
+
 my %link;
 for my $section (@sections) {
     my $page = $section eq 'Basics' ? "Modify.html" : "Modify$section.html";
@@ -67,14 +70,14 @@ for my $section (@sections) {
 </%init>
 <div class="asset-metadata">
 % for my $section (@sections) {
-<&| /Widgets/TitleBox, title => loc($section), title_href => $link{$section}, title_class => "inverse", class => "asset-\L$section" &>
+<&| /Widgets/TitleBox, title => loc($section), title_href => $can_edit ? $link{$section} : "", title_class => "inverse", class => "asset-\L$section" &>
     <& "Show$section", AssetObj => $AssetObj &>
 </&>
 % }
 
 <& /Elements/ShowCustomFieldCustomGroupings,
      Object => $AssetObj,
-     title_href => RT->Config->Get("WebPath") . "/Asset/ModifyCFs.html",
+     title_href => $can_edit ? RT->Config->Get("WebPath") . "/Asset/ModifyCFs.html" : "",
      TitleBoxARGS => { title_class => "inverse" },
  &>
 </div>

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



More information about the Bps-public-commit mailing list