|
a/Allura/allura/controllers/rest.py |
|
b/Allura/allura/controllers/rest.py |
|
... |
|
... |
126 |
log.error('Invalid token %s', oauth_token)
|
126 |
log.error('Invalid token %s', oauth_token)
|
127 |
raise exc.HTTPForbidden
|
127 |
raise exc.HTTPForbidden
|
128 |
return dict(
|
128 |
return dict(
|
129 |
oauth_token=oauth_token,
|
129 |
oauth_token=oauth_token,
|
130 |
consumer=rtok.consumer_token)
|
130 |
consumer=rtok.consumer_token)
|
131 |
|
131 |
|
132 |
@expose('jinja:allura:templates/oauth_authorize_ok.html')
|
132 |
@expose('jinja:allura:templates/oauth_authorize_ok.html')
|
133 |
def do_authorize(self, yes=None, no=None, oauth_token=None):
|
133 |
def do_authorize(self, yes=None, no=None, oauth_token=None):
|
134 |
security.require_authenticated()
|
134 |
security.require_authenticated()
|
135 |
rtok = M.OAuthRequestToken.query.get(api_key=oauth_token)
|
135 |
rtok = M.OAuthRequestToken.query.get(api_key=oauth_token)
|
136 |
if no:
|
136 |
if no:
|
|
... |
|
... |
203 |
|
203 |
|
204 |
class ProjectRestController(object):
|
204 |
class ProjectRestController(object):
|
205 |
|
205 |
|
206 |
@expose()
|
206 |
@expose()
|
207 |
def _lookup(self, name, *remainder):
|
207 |
def _lookup(self, name, *remainder):
|
|
|
208 |
if not name:
|
|
|
209 |
return self, ()
|
208 |
if not h.re_path_portion.match(name):
|
210 |
if not h.re_path_portion.match(name):
|
209 |
raise exc.HTTPNotFound, name
|
211 |
raise exc.HTTPNotFound, name
|
210 |
subproject = M.Project.query.get(shortname=c.project.shortname + '/' + name, deleted=False)
|
212 |
subproject = M.Project.query.get(shortname=c.project.shortname + '/' + name, deleted=False)
|
211 |
if subproject:
|
213 |
if subproject:
|
212 |
c.project = subproject
|
214 |
c.project = subproject
|
|
... |
|
... |
220 |
raise exc.HTTPNotFound, name
|
222 |
raise exc.HTTPNotFound, name
|
221 |
action_logger.info('', extra=dict(
|
223 |
action_logger.info('', extra=dict(
|
222 |
api_key=request.params.get('api_key')))
|
224 |
api_key=request.params.get('api_key')))
|
223 |
return app.api_root, remainder
|
225 |
return app.api_root, remainder
|
224 |
|
226 |
|
225 |
|
227 |
@expose('json:')
|
|
|
228 |
def index(self, **kw):
|
|
|
229 |
return dict(
|
|
|
230 |
name=c.project.shortname,
|
|
|
231 |
tools=[dict(name=t.tool_name, mount_point=t.options.mount_point, label=t.options.mount_label)
|
|
|
232 |
for t in c.project.app_configs]
|
|
|
233 |
)
|