allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [1/6] git commit: [#2584] ticket:260 check permissions in paged_search and test
Date Tue, 29 Jan 2013 20:00:28 GMT
[#2584] ticket:260 check  permissions in  paged_search and test


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f0e64e33
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f0e64e33
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f0e64e33

Branch: refs/heads/master
Commit: f0e64e33d93f5cfa6c9b0fc7d806b256d52c7459
Parents: dc9424f
Author: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Authored: Mon Jan 28 18:39:55 2013 +0400
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Tue Jan 29 19:59:49 2013 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/model/ticket.py          |    1 +
 .../forgetracker/templates/tracker/index.html      |    4 ++--
 .../forgetracker/templates/tracker/milestone.html  |    4 ++--
 .../forgetracker/templates/tracker/search.html     |    4 ++--
 .../forgetracker/tests/functional/test_root.py     |   10 ++++++++--
 5 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f0e64e33/ForgeTracker/forgetracker/model/ticket.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/model/ticket.py b/ForgeTracker/forgetracker/model/ticket.py
index 19bc1fd..e2be628 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -710,6 +710,7 @@ class Ticket(VersionedArtifact, ActivityObject, VotableArtifact):
             tickets = []
             for tn in ticket_numbers:
                 if tn in ticket_for_num:
+                    show_deleted = show_deleted and security.has_access(ticket_for_num[tn],
'delete', user, app_config.project)
                     if (security.has_access(ticket_for_num[tn], 'read', user, app_config.project)
and
                         (show_deleted or ticket_for_num[tn].deleted==False)):
                         tickets.append(ticket_for_num[tn])

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f0e64e33/ForgeTracker/forgetracker/templates/tracker/index.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/index.html b/ForgeTracker/forgetracker/templates/tracker/index.html
index 2efce2e..22dc2ef 100644
--- a/ForgeTracker/forgetracker/templates/tracker/index.html
+++ b/ForgeTracker/forgetracker/templates/tracker/index.html
@@ -24,9 +24,9 @@
     {%if h.has_access(c.app, 'delete') and c.app.globals.has_deleted_tickets()%}
         <p>
             {%if deleted%}
-                <a href="{{tg.url('', dict(q=q, limit=limit, sort=sort, deleted=False))}}">Hide
deleted tickets</a>
+                <a href="{{tg.url('', dict(q=q, page=page, limit=limit, sort=sort, deleted=False))}}">Hide
deleted tickets</a>
             {%else%}
-                <a  href="{{tg.url('', dict(q=q, limit=limit, sort=sort, deleted=True))}}">Show
deleted tickets</a>
+                <a  href="{{tg.url('', dict(q=q, page=page, limit=limit, sort=sort, deleted=True))}}">Show
deleted tickets</a>
             {%endif%}
         </p>
     {%endif%}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f0e64e33/ForgeTracker/forgetracker/templates/tracker/milestone.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/milestone.html b/ForgeTracker/forgetracker/templates/tracker/milestone.html
index be3500d..619c029 100644
--- a/ForgeTracker/forgetracker/templates/tracker/milestone.html
+++ b/ForgeTracker/forgetracker/templates/tracker/milestone.html
@@ -30,9 +30,9 @@
     {%if h.has_access(c.app, 'delete') and c.app.globals.has_deleted_tickets()%}
         <p>
             {%if deleted%}
-                <a href="{{tg.url('', dict(q=q, limit=limit, sort=sort, deleted=False))}}">Hide
deleted tickets</a>
+                <a href="{{tg.url('', dict(q=q, page=page, limit=limit, sort=sort, deleted=False))}}">Hide
deleted tickets</a>
             {%else%}
-                <a  href="{{tg.url('', dict(q=q, limit=limit, sort=sort, deleted=True))}}">Show
deleted tickets</a>
+                <a  href="{{tg.url('', dict(q=q, page=page, limit=limit, sort=sort, deleted=True))}}">Show
deleted tickets</a>
             {%endif%}
         </p>
     {%endif%}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f0e64e33/ForgeTracker/forgetracker/templates/tracker/search.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/search.html b/ForgeTracker/forgetracker/templates/tracker/search.html
index 31565f1..66a9100 100644
--- a/ForgeTracker/forgetracker/templates/tracker/search.html
+++ b/ForgeTracker/forgetracker/templates/tracker/search.html
@@ -32,9 +32,9 @@
 {%if h.has_access(c.app, 'delete') and c.app.globals.has_deleted_tickets()%}
 <p>
     {%if deleted%}
-    <a href="{{tg.url('', dict(q=q, limit=limit, sort=sort, deleted=False))}}">Hide
deleted tickets</a>
+    <a href="{{tg.url('', dict(q=q, page=page, limit=limit, sort=sort, deleted=False))}}">Hide
deleted tickets</a>
     {%else%}
-    <a  href="{{tg.url('', dict(q=q, limit=limit, sort=sort, deleted=True))}}">Show
deleted tickets</a>
+    <a  href="{{tg.url('', dict(q=q, page=page, limit=limit, sort=sort, deleted=True))}}">Show
deleted tickets</a>
     {%endif%}
 </p>
 {%endif%}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f0e64e33/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 781356a..f955060 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -1094,11 +1094,17 @@ class TestFunctionalController(TrackerTestController):
         assert 'No open tickets found.' in r
 
     def test_deleted_ticket_visible(self):
-        self.new_ticket(summary='Test ticket')
+        self.new_ticket(summary='test')
         self.app.post('/bugs/1/delete')
         r = self.app.get('/p/test/bugs/1/')
-        assert '#1 Test ticket' in r
+        assert '#1 test' in r
         self.app.get('/p/test/bugs/1/', extra_environ=dict(username='*anonymous'), status=404)
+        r = self.app.get('/p/test/bugs/',params=dict(q='test',deleted='True'))
+        assert '<td><a href="/p/test/bugs/1/">test' in r
+        assert '<tr class=" deleted">' in r
+        r = self.app.get('/p/test/bugs/',params=dict(q='test',deleted='True'),
+                         extra_environ=dict(username='*anonymous'))
+        assert 'No open tickets found.' in r
 
     def test_show_hide_deleted_tickets(self):
         self.new_ticket(summary='Test ticket')


Mime
View raw message