• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

Revisióndd64b9401ad41dc3c92aff955d7c5a56ab300952 (tree)
Tiempo2012-07-11 13:58:37
AutorDave Brondsema <dbrondsema@geek...>
CommiterDave Brondsema

Log Message

[#4272] do "read" checks in the rest api ticket index

Cambiar Resumen

Diferencia incremental

--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -163,12 +163,21 @@ class TestFunctionalController(TrackerTestController):
163163 r = self.app.get('/p/test/bugs/search/?q=ticket', extra_environ=env)
164164 assert '1 results' in r
165165 assert 'Private Ticket' not in r
166+ # ... or in search feed...
167+ r = self.app.get('/p/test/bugs/search_feed?q=ticket', extra_environ=env)
168+ assert 'Private Ticket' not in r
166169 # ...and can't get to the private ticket directly.
167170 r = self.app.get(ticket_view.request.url, extra_environ=env)
168171 assert 'Private Ticket' not in r
169172 # ... and it doesn't appear in the feed
170173 r = self.app.get('/p/test/bugs/feed.atom')
171174 assert 'Private Ticket' not in r
175+ # ... or in the API ...
176+ r = self.app.get('/rest/p/test/bugs/2/')
177+ assert 'Private Ticket' not in r
178+ assert '/auth/?return_to' in r.headers['Location']
179+ r = self.app.get('/rest/p/test/bugs/')
180+ assert 'Private Ticket' not in r
172181
173182 @td.with_tool('test', 'Tickets', 'doc-bugs')
174183 def test_two_trackers(self):
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -1304,10 +1304,14 @@ class RootRestController(BaseController):
13041304 require_access(c.app, 'read')
13051305
13061306 @expose('json:')
1307- def index(self, **kw):
1308- return dict(tickets=[
1309- dict(ticket_num=t.ticket_num, summary=t.summary)
1310- for t in TM.Ticket.query.find(dict(app_config_id=c.app.config._id)).sort('ticket_num') ])
1307+ def index(self, limit=100, page=0, **kw):
1308+ results = TM.Ticket.paged_query(c.app.config, c.user, query={},
1309+ limit=int(limit), page=int(page))
1310+ results['tickets'] = [dict(ticket_num=t.ticket_num, summary=t.summary)
1311+ for t in results['tickets']]
1312+ results.pop('q', None)
1313+ results.pop('sort', None)
1314+ return results
13111315
13121316 @expose()
13131317 @h.vardec