Author: gjm
Date: Mon Jul  6 07:26:13 2015
New Revision: 1689326

URL: http://svn.apache.org/r1689326
Log:
#813: Adjusting relations permissions so TICKET_VIEW sufficient to view.

Modified:
    
bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_relations.html
    bloodhound/trunk/bloodhound_relations/bhrelations/web_ui.py
    bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html

Modified: 
bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_relations.html
URL: 
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_relations.html?rev=1689326&r1=1689325&r2=1689326&view=diff
==============================================================================
--- 
bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_relations.html
 (original)
+++ 
bloodhound/trunk/bloodhound_dashboard/bhdashboard/widgets/templates/widget_relations.html
 Mon Jul  6 07:26:13 2015
@@ -22,7 +22,14 @@
   xmlns:py="http://genshi.edgewall.org/";
   xmlns:xi="http://www.w3.org/2001/XInclude";
   xmlns:i18n="http://genshi.edgewall.org/i18n";
-  i18n:domain="bhdashboard">
+  i18n:domain="bhdashboard"
+  py:with="can_append = 'TICKET_APPEND' in perm(ticket.resource);
+     can_create = 'TICKET_CREATE' in perm(ticket.resource) and not 
ticket.exists;
+     can_modify = 'TICKET_CHGPROP' in perm(ticket.resource);
+     can_edit = 'TICKET_EDIT_DESCRIPTION' in perm(ticket.resource);
+     has_property_editor = not version and version != 0 and not cnum_edit
+                           and (can_append or can_modify or can_edit or 
can_create);
+  ">
 
   <py:choose test="">
     <py:when test="relations">
@@ -64,7 +71,7 @@
     </py:otherwise>
   </py:choose>
 
-  <div class="btn-group">
+  <div py:if="has_property_editor" class="btn-group">
     <form method="get" action="${href.ticket(ticket.id, 'relations')}">
       <button type="submit" class="btn" id="manage-relations"><i 
class="icon-retweet"></i> Manage relations</button>
     </form>

Modified: bloodhound/trunk/bloodhound_relations/bhrelations/web_ui.py
URL: 
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_relations/bhrelations/web_ui.py?rev=1689326&r1=1689325&r2=1689326&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_relations/bhrelations/web_ui.py (original)
+++ bloodhound/trunk/bloodhound_relations/bhrelations/web_ui.py Mon Jul  6 
07:26:13 2015
@@ -65,7 +65,8 @@ class RelationManagementModule(Component
         except ValueError:
             raise TracError(_('Invalid ticket id.'))
 
-        req.perm.require('TICKET_VIEW')
+        # For access to the relation management, TICKET_MODIFY is required.
+        req.perm.require('TICKET_MODIFY')
         relsys = RelationsSystem(self.env)
 
         data = {
@@ -74,7 +75,6 @@ class RelationManagementModule(Component
         if req.method == 'POST':
             # for modifying the relations TICKET_MODIFY is required for
             # both the source and the destination tickets
-            req.perm.require('TICKET_MODIFY')
 
             if 'remove' in req.args:
                 rellist = req.args.get('sel')

Modified: bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html
URL: 
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html?rev=1689326&r1=1689325&r2=1689326&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html 
(original)
+++ bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_ticket.html Mon Jul  
6 07:26:13 2015
@@ -445,7 +445,7 @@
             </div>
           </form>
 
-          <div py:if="bhrelations and ticket.exists and has_property_editor" 
class="relations">
+          <div py:if="bhrelations and ticket.exists" class="relations">
             <bh:widget urn="TicketRelations">
               <bh:args>
                 <bh:arg name="tid">$ticket.id</bh:arg>


Reply via email to