|
@@
-1,347
+1,343
b''
|
|
1
|
# -*- coding: utf-8 -*-
|
|
1
|
# -*- coding: utf-8 -*-
|
|
2
|
|
|
2
|
|
|
3
|
# Copyright (C) 2010-2017 RhodeCode GmbH
|
|
3
|
# Copyright (C) 2010-2017 RhodeCode GmbH
|
|
4
|
#
|
|
4
|
#
|
|
5
|
# This program is free software: you can redistribute it and/or modify
|
|
5
|
# This program is free software: you can redistribute it and/or modify
|
|
6
|
# it under the terms of the GNU Affero General Public License, version 3
|
|
6
|
# it under the terms of the GNU Affero General Public License, version 3
|
|
7
|
# (only), as published by the Free Software Foundation.
|
|
7
|
# (only), as published by the Free Software Foundation.
|
|
8
|
#
|
|
8
|
#
|
|
9
|
# This program is distributed in the hope that it will be useful,
|
|
9
|
# This program is distributed in the hope that it will be useful,
|
|
10
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
# GNU General Public License for more details.
|
|
12
|
# GNU General Public License for more details.
|
|
13
|
#
|
|
13
|
#
|
|
14
|
# You should have received a copy of the GNU Affero General Public License
|
|
14
|
# You should have received a copy of the GNU Affero General Public License
|
|
15
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
#
|
|
16
|
#
|
|
17
|
# This program is dual-licensed. If you wish to learn more about the
|
|
17
|
# This program is dual-licensed. If you wish to learn more about the
|
|
18
|
# RhodeCode Enterprise Edition, including its added features, Support services,
|
|
18
|
# RhodeCode Enterprise Edition, including its added features, Support services,
|
|
19
|
# and proprietary license terms, please see https://rhodecode.com/licenses/
|
|
19
|
# and proprietary license terms, please see https://rhodecode.com/licenses/
|
|
20
|
|
|
20
|
|
|
21
|
"""
|
|
21
|
"""
|
|
22
|
Routes configuration
|
|
22
|
Routes configuration
|
|
23
|
|
|
23
|
|
|
24
|
The more specific and detailed routes should be defined first so they
|
|
24
|
The more specific and detailed routes should be defined first so they
|
|
25
|
may take precedent over the more generic routes. For more information
|
|
25
|
may take precedent over the more generic routes. For more information
|
|
26
|
refer to the routes manual at http://routes.groovie.org/docs/
|
|
26
|
refer to the routes manual at http://routes.groovie.org/docs/
|
|
27
|
|
|
27
|
|
|
28
|
IMPORTANT: if you change any routing here, make sure to take a look at lib/base.py
|
|
28
|
IMPORTANT: if you change any routing here, make sure to take a look at lib/base.py
|
|
29
|
and _route_name variable which uses some of stored naming here to do redirects.
|
|
29
|
and _route_name variable which uses some of stored naming here to do redirects.
|
|
30
|
"""
|
|
30
|
"""
|
|
31
|
import os
|
|
31
|
import os
|
|
32
|
import re
|
|
32
|
import re
|
|
33
|
from routes import Mapper
|
|
33
|
from routes import Mapper
|
|
34
|
|
|
34
|
|
|
35
|
# prefix for non repository related links needs to be prefixed with `/`
|
|
35
|
# prefix for non repository related links needs to be prefixed with `/`
|
|
36
|
ADMIN_PREFIX = '/_admin'
|
|
36
|
ADMIN_PREFIX = '/_admin'
|
|
37
|
STATIC_FILE_PREFIX = '/_static'
|
|
37
|
STATIC_FILE_PREFIX = '/_static'
|
|
38
|
|
|
38
|
|
|
39
|
# Default requirements for URL parts
|
|
39
|
# Default requirements for URL parts
|
|
40
|
URL_NAME_REQUIREMENTS = {
|
|
40
|
URL_NAME_REQUIREMENTS = {
|
|
41
|
# group name can have a slash in them, but they must not end with a slash
|
|
41
|
# group name can have a slash in them, but they must not end with a slash
|
|
42
|
'group_name': r'.*?[^/]',
|
|
42
|
'group_name': r'.*?[^/]',
|
|
43
|
'repo_group_name': r'.*?[^/]',
|
|
43
|
'repo_group_name': r'.*?[^/]',
|
|
44
|
# repo names can have a slash in them, but they must not end with a slash
|
|
44
|
# repo names can have a slash in them, but they must not end with a slash
|
|
45
|
'repo_name': r'.*?[^/]',
|
|
45
|
'repo_name': r'.*?[^/]',
|
|
46
|
# file path eats up everything at the end
|
|
46
|
# file path eats up everything at the end
|
|
47
|
'f_path': r'.*',
|
|
47
|
'f_path': r'.*',
|
|
48
|
# reference types
|
|
48
|
# reference types
|
|
49
|
'source_ref_type': '(branch|book|tag|rev|\%\(source_ref_type\)s)',
|
|
49
|
'source_ref_type': '(branch|book|tag|rev|\%\(source_ref_type\)s)',
|
|
50
|
'target_ref_type': '(branch|book|tag|rev|\%\(target_ref_type\)s)',
|
|
50
|
'target_ref_type': '(branch|book|tag|rev|\%\(target_ref_type\)s)',
|
|
51
|
}
|
|
51
|
}
|
|
52
|
|
|
52
|
|
|
53
|
|
|
53
|
|
|
54
|
class JSRoutesMapper(Mapper):
|
|
54
|
class JSRoutesMapper(Mapper):
|
|
55
|
"""
|
|
55
|
"""
|
|
56
|
Wrapper for routes.Mapper to make pyroutes compatible url definitions
|
|
56
|
Wrapper for routes.Mapper to make pyroutes compatible url definitions
|
|
57
|
"""
|
|
57
|
"""
|
|
58
|
_named_route_regex = re.compile(r'^[a-z-_0-9A-Z]+$')
|
|
58
|
_named_route_regex = re.compile(r'^[a-z-_0-9A-Z]+$')
|
|
59
|
_argument_prog = re.compile('\{(.*?)\}|:\((.*)\)')
|
|
59
|
_argument_prog = re.compile('\{(.*?)\}|:\((.*)\)')
|
|
60
|
def __init__(self, *args, **kw):
|
|
60
|
def __init__(self, *args, **kw):
|
|
61
|
super(JSRoutesMapper, self).__init__(*args, **kw)
|
|
61
|
super(JSRoutesMapper, self).__init__(*args, **kw)
|
|
62
|
self._jsroutes = []
|
|
62
|
self._jsroutes = []
|
|
63
|
|
|
63
|
|
|
64
|
def connect(self, *args, **kw):
|
|
64
|
def connect(self, *args, **kw):
|
|
65
|
"""
|
|
65
|
"""
|
|
66
|
Wrapper for connect to take an extra argument jsroute=True
|
|
66
|
Wrapper for connect to take an extra argument jsroute=True
|
|
67
|
|
|
67
|
|
|
68
|
:param jsroute: boolean, if True will add the route to the pyroutes list
|
|
68
|
:param jsroute: boolean, if True will add the route to the pyroutes list
|
|
69
|
"""
|
|
69
|
"""
|
|
70
|
if kw.pop('jsroute', False):
|
|
70
|
if kw.pop('jsroute', False):
|
|
71
|
if not self._named_route_regex.match(args[0]):
|
|
71
|
if not self._named_route_regex.match(args[0]):
|
|
72
|
raise Exception('only named routes can be added to pyroutes')
|
|
72
|
raise Exception('only named routes can be added to pyroutes')
|
|
73
|
self._jsroutes.append(args[0])
|
|
73
|
self._jsroutes.append(args[0])
|
|
74
|
|
|
74
|
|
|
75
|
super(JSRoutesMapper, self).connect(*args, **kw)
|
|
75
|
super(JSRoutesMapper, self).connect(*args, **kw)
|
|
76
|
|
|
76
|
|
|
77
|
def _extract_route_information(self, route):
|
|
77
|
def _extract_route_information(self, route):
|
|
78
|
"""
|
|
78
|
"""
|
|
79
|
Convert a route into tuple(name, path, args), eg:
|
|
79
|
Convert a route into tuple(name, path, args), eg:
|
|
80
|
('show_user', '/profile/%(username)s', ['username'])
|
|
80
|
('show_user', '/profile/%(username)s', ['username'])
|
|
81
|
"""
|
|
81
|
"""
|
|
82
|
routepath = route.routepath
|
|
82
|
routepath = route.routepath
|
|
83
|
def replace(matchobj):
|
|
83
|
def replace(matchobj):
|
|
84
|
if matchobj.group(1):
|
|
84
|
if matchobj.group(1):
|
|
85
|
return "%%(%s)s" % matchobj.group(1).split(':')[0]
|
|
85
|
return "%%(%s)s" % matchobj.group(1).split(':')[0]
|
|
86
|
else:
|
|
86
|
else:
|
|
87
|
return "%%(%s)s" % matchobj.group(2)
|
|
87
|
return "%%(%s)s" % matchobj.group(2)
|
|
88
|
|
|
88
|
|
|
89
|
routepath = self._argument_prog.sub(replace, routepath)
|
|
89
|
routepath = self._argument_prog.sub(replace, routepath)
|
|
90
|
return (
|
|
90
|
return (
|
|
91
|
route.name,
|
|
91
|
route.name,
|
|
92
|
routepath,
|
|
92
|
routepath,
|
|
93
|
[(arg[0].split(':')[0] if arg[0] != '' else arg[1])
|
|
93
|
[(arg[0].split(':')[0] if arg[0] != '' else arg[1])
|
|
94
|
for arg in self._argument_prog.findall(route.routepath)]
|
|
94
|
for arg in self._argument_prog.findall(route.routepath)]
|
|
95
|
)
|
|
95
|
)
|
|
96
|
|
|
96
|
|
|
97
|
def jsroutes(self):
|
|
97
|
def jsroutes(self):
|
|
98
|
"""
|
|
98
|
"""
|
|
99
|
Return a list of pyroutes.js compatible routes
|
|
99
|
Return a list of pyroutes.js compatible routes
|
|
100
|
"""
|
|
100
|
"""
|
|
101
|
for route_name in self._jsroutes:
|
|
101
|
for route_name in self._jsroutes:
|
|
102
|
yield self._extract_route_information(self._routenames[route_name])
|
|
102
|
yield self._extract_route_information(self._routenames[route_name])
|
|
103
|
|
|
103
|
|
|
104
|
|
|
104
|
|
|
105
|
def make_map(config):
|
|
105
|
def make_map(config):
|
|
106
|
"""Create, configure and return the routes Mapper"""
|
|
106
|
"""Create, configure and return the routes Mapper"""
|
|
107
|
rmap = JSRoutesMapper(
|
|
107
|
rmap = JSRoutesMapper(
|
|
108
|
directory=config['pylons.paths']['controllers'],
|
|
108
|
directory=config['pylons.paths']['controllers'],
|
|
109
|
always_scan=config['debug'])
|
|
109
|
always_scan=config['debug'])
|
|
110
|
rmap.minimization = False
|
|
110
|
rmap.minimization = False
|
|
111
|
rmap.explicit = False
|
|
111
|
rmap.explicit = False
|
|
112
|
|
|
112
|
|
|
113
|
from rhodecode.lib.utils2 import str2bool
|
|
113
|
from rhodecode.lib.utils2 import str2bool
|
|
114
|
from rhodecode.model import repo, repo_group
|
|
114
|
from rhodecode.model import repo, repo_group
|
|
115
|
|
|
115
|
|
|
116
|
def check_repo(environ, match_dict):
|
|
116
|
def check_repo(environ, match_dict):
|
|
117
|
"""
|
|
117
|
"""
|
|
118
|
check for valid repository for proper 404 handling
|
|
118
|
check for valid repository for proper 404 handling
|
|
119
|
|
|
119
|
|
|
120
|
:param environ:
|
|
120
|
:param environ:
|
|
121
|
:param match_dict:
|
|
121
|
:param match_dict:
|
|
122
|
"""
|
|
122
|
"""
|
|
123
|
repo_name = match_dict.get('repo_name')
|
|
123
|
repo_name = match_dict.get('repo_name')
|
|
124
|
|
|
124
|
|
|
125
|
if match_dict.get('f_path'):
|
|
125
|
if match_dict.get('f_path'):
|
|
126
|
# fix for multiple initial slashes that causes errors
|
|
126
|
# fix for multiple initial slashes that causes errors
|
|
127
|
match_dict['f_path'] = match_dict['f_path'].lstrip('/')
|
|
127
|
match_dict['f_path'] = match_dict['f_path'].lstrip('/')
|
|
128
|
repo_model = repo.RepoModel()
|
|
128
|
repo_model = repo.RepoModel()
|
|
129
|
by_name_match = repo_model.get_by_repo_name(repo_name)
|
|
129
|
by_name_match = repo_model.get_by_repo_name(repo_name)
|
|
130
|
# if we match quickly from database, short circuit the operation,
|
|
130
|
# if we match quickly from database, short circuit the operation,
|
|
131
|
# and validate repo based on the type.
|
|
131
|
# and validate repo based on the type.
|
|
132
|
if by_name_match:
|
|
132
|
if by_name_match:
|
|
133
|
return True
|
|
133
|
return True
|
|
134
|
|
|
134
|
|
|
135
|
by_id_match = repo_model.get_repo_by_id(repo_name)
|
|
135
|
by_id_match = repo_model.get_repo_by_id(repo_name)
|
|
136
|
if by_id_match:
|
|
136
|
if by_id_match:
|
|
137
|
repo_name = by_id_match.repo_name
|
|
137
|
repo_name = by_id_match.repo_name
|
|
138
|
match_dict['repo_name'] = repo_name
|
|
138
|
match_dict['repo_name'] = repo_name
|
|
139
|
return True
|
|
139
|
return True
|
|
140
|
|
|
140
|
|
|
141
|
return False
|
|
141
|
return False
|
|
142
|
|
|
142
|
|
|
143
|
def check_group(environ, match_dict):
|
|
143
|
def check_group(environ, match_dict):
|
|
144
|
"""
|
|
144
|
"""
|
|
145
|
check for valid repository group path for proper 404 handling
|
|
145
|
check for valid repository group path for proper 404 handling
|
|
146
|
|
|
146
|
|
|
147
|
:param environ:
|
|
147
|
:param environ:
|
|
148
|
:param match_dict:
|
|
148
|
:param match_dict:
|
|
149
|
"""
|
|
149
|
"""
|
|
150
|
repo_group_name = match_dict.get('group_name')
|
|
150
|
repo_group_name = match_dict.get('group_name')
|
|
151
|
repo_group_model = repo_group.RepoGroupModel()
|
|
151
|
repo_group_model = repo_group.RepoGroupModel()
|
|
152
|
by_name_match = repo_group_model.get_by_group_name(repo_group_name)
|
|
152
|
by_name_match = repo_group_model.get_by_group_name(repo_group_name)
|
|
153
|
if by_name_match:
|
|
153
|
if by_name_match:
|
|
154
|
return True
|
|
154
|
return True
|
|
155
|
|
|
155
|
|
|
156
|
return False
|
|
156
|
return False
|
|
157
|
|
|
157
|
|
|
158
|
def check_user_group(environ, match_dict):
|
|
158
|
def check_user_group(environ, match_dict):
|
|
159
|
"""
|
|
159
|
"""
|
|
160
|
check for valid user group for proper 404 handling
|
|
160
|
check for valid user group for proper 404 handling
|
|
161
|
|
|
161
|
|
|
162
|
:param environ:
|
|
162
|
:param environ:
|
|
163
|
:param match_dict:
|
|
163
|
:param match_dict:
|
|
164
|
"""
|
|
164
|
"""
|
|
165
|
return True
|
|
165
|
return True
|
|
166
|
|
|
166
|
|
|
167
|
def check_int(environ, match_dict):
|
|
167
|
def check_int(environ, match_dict):
|
|
168
|
return match_dict.get('id').isdigit()
|
|
168
|
return match_dict.get('id').isdigit()
|
|
169
|
|
|
169
|
|
|
170
|
|
|
170
|
|
|
171
|
#==========================================================================
|
|
171
|
#==========================================================================
|
|
172
|
# CUSTOM ROUTES HERE
|
|
172
|
# CUSTOM ROUTES HERE
|
|
173
|
#==========================================================================
|
|
173
|
#==========================================================================
|
|
174
|
|
|
174
|
|
|
175
|
# ping and pylons error test
|
|
|
|
|
176
|
rmap.connect('ping', '%s/ping' % (ADMIN_PREFIX,), controller='home', action='ping')
|
|
|
|
|
177
|
rmap.connect('error_test', '%s/error_test' % (ADMIN_PREFIX,), controller='home', action='error_test')
|
|
|
|
|
178
|
|
|
|
|
|
179
|
# ADMIN REPOSITORY GROUPS ROUTES
|
|
175
|
# ADMIN REPOSITORY GROUPS ROUTES
|
|
180
|
with rmap.submapper(path_prefix=ADMIN_PREFIX,
|
|
176
|
with rmap.submapper(path_prefix=ADMIN_PREFIX,
|
|
181
|
controller='admin/repo_groups') as m:
|
|
177
|
controller='admin/repo_groups') as m:
|
|
182
|
m.connect('repo_groups', '/repo_groups',
|
|
178
|
m.connect('repo_groups', '/repo_groups',
|
|
183
|
action='create', conditions={'method': ['POST']})
|
|
179
|
action='create', conditions={'method': ['POST']})
|
|
184
|
m.connect('repo_groups', '/repo_groups',
|
|
180
|
m.connect('repo_groups', '/repo_groups',
|
|
185
|
action='index', conditions={'method': ['GET']})
|
|
181
|
action='index', conditions={'method': ['GET']})
|
|
186
|
m.connect('new_repo_group', '/repo_groups/new',
|
|
182
|
m.connect('new_repo_group', '/repo_groups/new',
|
|
187
|
action='new', conditions={'method': ['GET']})
|
|
183
|
action='new', conditions={'method': ['GET']})
|
|
188
|
m.connect('update_repo_group', '/repo_groups/{group_name}',
|
|
184
|
m.connect('update_repo_group', '/repo_groups/{group_name}',
|
|
189
|
action='update', conditions={'method': ['PUT'],
|
|
185
|
action='update', conditions={'method': ['PUT'],
|
|
190
|
'function': check_group},
|
|
186
|
'function': check_group},
|
|
191
|
requirements=URL_NAME_REQUIREMENTS)
|
|
187
|
requirements=URL_NAME_REQUIREMENTS)
|
|
192
|
|
|
188
|
|
|
193
|
# EXTRAS REPO GROUP ROUTES
|
|
189
|
# EXTRAS REPO GROUP ROUTES
|
|
194
|
m.connect('edit_repo_group', '/repo_groups/{group_name}/edit',
|
|
190
|
m.connect('edit_repo_group', '/repo_groups/{group_name}/edit',
|
|
195
|
action='edit',
|
|
191
|
action='edit',
|
|
196
|
conditions={'method': ['GET'], 'function': check_group},
|
|
192
|
conditions={'method': ['GET'], 'function': check_group},
|
|
197
|
requirements=URL_NAME_REQUIREMENTS)
|
|
193
|
requirements=URL_NAME_REQUIREMENTS)
|
|
198
|
m.connect('edit_repo_group', '/repo_groups/{group_name}/edit',
|
|
194
|
m.connect('edit_repo_group', '/repo_groups/{group_name}/edit',
|
|
199
|
action='edit',
|
|
195
|
action='edit',
|
|
200
|
conditions={'method': ['PUT'], 'function': check_group},
|
|
196
|
conditions={'method': ['PUT'], 'function': check_group},
|
|
201
|
requirements=URL_NAME_REQUIREMENTS)
|
|
197
|
requirements=URL_NAME_REQUIREMENTS)
|
|
202
|
|
|
198
|
|
|
203
|
m.connect('edit_repo_group_advanced', '/repo_groups/{group_name}/edit/advanced',
|
|
199
|
m.connect('edit_repo_group_advanced', '/repo_groups/{group_name}/edit/advanced',
|
|
204
|
action='edit_repo_group_advanced',
|
|
200
|
action='edit_repo_group_advanced',
|
|
205
|
conditions={'method': ['GET'], 'function': check_group},
|
|
201
|
conditions={'method': ['GET'], 'function': check_group},
|
|
206
|
requirements=URL_NAME_REQUIREMENTS)
|
|
202
|
requirements=URL_NAME_REQUIREMENTS)
|
|
207
|
m.connect('edit_repo_group_advanced', '/repo_groups/{group_name}/edit/advanced',
|
|
203
|
m.connect('edit_repo_group_advanced', '/repo_groups/{group_name}/edit/advanced',
|
|
208
|
action='edit_repo_group_advanced',
|
|
204
|
action='edit_repo_group_advanced',
|
|
209
|
conditions={'method': ['PUT'], 'function': check_group},
|
|
205
|
conditions={'method': ['PUT'], 'function': check_group},
|
|
210
|
requirements=URL_NAME_REQUIREMENTS)
|
|
206
|
requirements=URL_NAME_REQUIREMENTS)
|
|
211
|
|
|
207
|
|
|
212
|
m.connect('edit_repo_group_perms', '/repo_groups/{group_name}/edit/permissions',
|
|
208
|
m.connect('edit_repo_group_perms', '/repo_groups/{group_name}/edit/permissions',
|
|
213
|
action='edit_repo_group_perms',
|
|
209
|
action='edit_repo_group_perms',
|
|
214
|
conditions={'method': ['GET'], 'function': check_group},
|
|
210
|
conditions={'method': ['GET'], 'function': check_group},
|
|
215
|
requirements=URL_NAME_REQUIREMENTS)
|
|
211
|
requirements=URL_NAME_REQUIREMENTS)
|
|
216
|
m.connect('edit_repo_group_perms', '/repo_groups/{group_name}/edit/permissions',
|
|
212
|
m.connect('edit_repo_group_perms', '/repo_groups/{group_name}/edit/permissions',
|
|
217
|
action='update_perms',
|
|
213
|
action='update_perms',
|
|
218
|
conditions={'method': ['PUT'], 'function': check_group},
|
|
214
|
conditions={'method': ['PUT'], 'function': check_group},
|
|
219
|
requirements=URL_NAME_REQUIREMENTS)
|
|
215
|
requirements=URL_NAME_REQUIREMENTS)
|
|
220
|
|
|
216
|
|
|
221
|
m.connect('delete_repo_group', '/repo_groups/{group_name}',
|
|
217
|
m.connect('delete_repo_group', '/repo_groups/{group_name}',
|
|
222
|
action='delete', conditions={'method': ['DELETE'],
|
|
218
|
action='delete', conditions={'method': ['DELETE'],
|
|
223
|
'function': check_group},
|
|
219
|
'function': check_group},
|
|
224
|
requirements=URL_NAME_REQUIREMENTS)
|
|
220
|
requirements=URL_NAME_REQUIREMENTS)
|
|
225
|
|
|
221
|
|
|
226
|
# ADMIN USER ROUTES
|
|
222
|
# ADMIN USER ROUTES
|
|
227
|
with rmap.submapper(path_prefix=ADMIN_PREFIX,
|
|
223
|
with rmap.submapper(path_prefix=ADMIN_PREFIX,
|
|
228
|
controller='admin/users') as m:
|
|
224
|
controller='admin/users') as m:
|
|
229
|
m.connect('users', '/users',
|
|
225
|
m.connect('users', '/users',
|
|
230
|
action='create', conditions={'method': ['POST']})
|
|
226
|
action='create', conditions={'method': ['POST']})
|
|
231
|
m.connect('new_user', '/users/new',
|
|
227
|
m.connect('new_user', '/users/new',
|
|
232
|
action='new', conditions={'method': ['GET']})
|
|
228
|
action='new', conditions={'method': ['GET']})
|
|
233
|
m.connect('update_user', '/users/{user_id}',
|
|
229
|
m.connect('update_user', '/users/{user_id}',
|
|
234
|
action='update', conditions={'method': ['PUT']})
|
|
230
|
action='update', conditions={'method': ['PUT']})
|
|
235
|
m.connect('delete_user', '/users/{user_id}',
|
|
231
|
m.connect('delete_user', '/users/{user_id}',
|
|
236
|
action='delete', conditions={'method': ['DELETE']})
|
|
232
|
action='delete', conditions={'method': ['DELETE']})
|
|
237
|
m.connect('edit_user', '/users/{user_id}/edit',
|
|
233
|
m.connect('edit_user', '/users/{user_id}/edit',
|
|
238
|
action='edit', conditions={'method': ['GET']}, jsroute=True)
|
|
234
|
action='edit', conditions={'method': ['GET']}, jsroute=True)
|
|
239
|
m.connect('user', '/users/{user_id}',
|
|
235
|
m.connect('user', '/users/{user_id}',
|
|
240
|
action='show', conditions={'method': ['GET']})
|
|
236
|
action='show', conditions={'method': ['GET']})
|
|
241
|
m.connect('force_password_reset_user', '/users/{user_id}/password_reset',
|
|
237
|
m.connect('force_password_reset_user', '/users/{user_id}/password_reset',
|
|
242
|
action='reset_password', conditions={'method': ['POST']})
|
|
238
|
action='reset_password', conditions={'method': ['POST']})
|
|
243
|
m.connect('create_personal_repo_group', '/users/{user_id}/create_repo_group',
|
|
239
|
m.connect('create_personal_repo_group', '/users/{user_id}/create_repo_group',
|
|
244
|
action='create_personal_repo_group', conditions={'method': ['POST']})
|
|
240
|
action='create_personal_repo_group', conditions={'method': ['POST']})
|
|
245
|
|
|
241
|
|
|
246
|
# EXTRAS USER ROUTES
|
|
242
|
# EXTRAS USER ROUTES
|
|
247
|
m.connect('edit_user_advanced', '/users/{user_id}/edit/advanced',
|
|
243
|
m.connect('edit_user_advanced', '/users/{user_id}/edit/advanced',
|
|
248
|
action='edit_advanced', conditions={'method': ['GET']})
|
|
244
|
action='edit_advanced', conditions={'method': ['GET']})
|
|
249
|
m.connect('edit_user_advanced', '/users/{user_id}/edit/advanced',
|
|
245
|
m.connect('edit_user_advanced', '/users/{user_id}/edit/advanced',
|
|
250
|
action='update_advanced', conditions={'method': ['PUT']})
|
|
246
|
action='update_advanced', conditions={'method': ['PUT']})
|
|
251
|
|
|
247
|
|
|
252
|
m.connect('edit_user_global_perms', '/users/{user_id}/edit/global_permissions',
|
|
248
|
m.connect('edit_user_global_perms', '/users/{user_id}/edit/global_permissions',
|
|
253
|
action='edit_global_perms', conditions={'method': ['GET']})
|
|
249
|
action='edit_global_perms', conditions={'method': ['GET']})
|
|
254
|
m.connect('edit_user_global_perms', '/users/{user_id}/edit/global_permissions',
|
|
250
|
m.connect('edit_user_global_perms', '/users/{user_id}/edit/global_permissions',
|
|
255
|
action='update_global_perms', conditions={'method': ['PUT']})
|
|
251
|
action='update_global_perms', conditions={'method': ['PUT']})
|
|
256
|
|
|
252
|
|
|
257
|
# ADMIN SETTINGS ROUTES
|
|
253
|
# ADMIN SETTINGS ROUTES
|
|
258
|
with rmap.submapper(path_prefix=ADMIN_PREFIX,
|
|
254
|
with rmap.submapper(path_prefix=ADMIN_PREFIX,
|
|
259
|
controller='admin/settings') as m:
|
|
255
|
controller='admin/settings') as m:
|
|
260
|
|
|
256
|
|
|
261
|
# default
|
|
257
|
# default
|
|
262
|
m.connect('admin_settings', '/settings',
|
|
258
|
m.connect('admin_settings', '/settings',
|
|
263
|
action='settings_global_update',
|
|
259
|
action='settings_global_update',
|
|
264
|
conditions={'method': ['POST']})
|
|
260
|
conditions={'method': ['POST']})
|
|
265
|
m.connect('admin_settings', '/settings',
|
|
261
|
m.connect('admin_settings', '/settings',
|
|
266
|
action='settings_global', conditions={'method': ['GET']})
|
|
262
|
action='settings_global', conditions={'method': ['GET']})
|
|
267
|
|
|
263
|
|
|
268
|
m.connect('admin_settings_vcs', '/settings/vcs',
|
|
264
|
m.connect('admin_settings_vcs', '/settings/vcs',
|
|
269
|
action='settings_vcs_update',
|
|
265
|
action='settings_vcs_update',
|
|
270
|
conditions={'method': ['POST']})
|
|
266
|
conditions={'method': ['POST']})
|
|
271
|
m.connect('admin_settings_vcs', '/settings/vcs',
|
|
267
|
m.connect('admin_settings_vcs', '/settings/vcs',
|
|
272
|
action='settings_vcs',
|
|
268
|
action='settings_vcs',
|
|
273
|
conditions={'method': ['GET']})
|
|
269
|
conditions={'method': ['GET']})
|
|
274
|
m.connect('admin_settings_vcs', '/settings/vcs',
|
|
270
|
m.connect('admin_settings_vcs', '/settings/vcs',
|
|
275
|
action='delete_svn_pattern',
|
|
271
|
action='delete_svn_pattern',
|
|
276
|
conditions={'method': ['DELETE']})
|
|
272
|
conditions={'method': ['DELETE']})
|
|
277
|
|
|
273
|
|
|
278
|
m.connect('admin_settings_mapping', '/settings/mapping',
|
|
274
|
m.connect('admin_settings_mapping', '/settings/mapping',
|
|
279
|
action='settings_mapping_update',
|
|
275
|
action='settings_mapping_update',
|
|
280
|
conditions={'method': ['POST']})
|
|
276
|
conditions={'method': ['POST']})
|
|
281
|
m.connect('admin_settings_mapping', '/settings/mapping',
|
|
277
|
m.connect('admin_settings_mapping', '/settings/mapping',
|
|
282
|
action='settings_mapping', conditions={'method': ['GET']})
|
|
278
|
action='settings_mapping', conditions={'method': ['GET']})
|
|
283
|
|
|
279
|
|
|
284
|
m.connect('admin_settings_global', '/settings/global',
|
|
280
|
m.connect('admin_settings_global', '/settings/global',
|
|
285
|
action='settings_global_update',
|
|
281
|
action='settings_global_update',
|
|
286
|
conditions={'method': ['POST']})
|
|
282
|
conditions={'method': ['POST']})
|
|
287
|
m.connect('admin_settings_global', '/settings/global',
|
|
283
|
m.connect('admin_settings_global', '/settings/global',
|
|
288
|
action='settings_global', conditions={'method': ['GET']})
|
|
284
|
action='settings_global', conditions={'method': ['GET']})
|
|
289
|
|
|
285
|
|
|
290
|
m.connect('admin_settings_visual', '/settings/visual',
|
|
286
|
m.connect('admin_settings_visual', '/settings/visual',
|
|
291
|
action='settings_visual_update',
|
|
287
|
action='settings_visual_update',
|
|
292
|
conditions={'method': ['POST']})
|
|
288
|
conditions={'method': ['POST']})
|
|
293
|
m.connect('admin_settings_visual', '/settings/visual',
|
|
289
|
m.connect('admin_settings_visual', '/settings/visual',
|
|
294
|
action='settings_visual', conditions={'method': ['GET']})
|
|
290
|
action='settings_visual', conditions={'method': ['GET']})
|
|
295
|
|
|
291
|
|
|
296
|
m.connect('admin_settings_issuetracker',
|
|
292
|
m.connect('admin_settings_issuetracker',
|
|
297
|
'/settings/issue-tracker', action='settings_issuetracker',
|
|
293
|
'/settings/issue-tracker', action='settings_issuetracker',
|
|
298
|
conditions={'method': ['GET']})
|
|
294
|
conditions={'method': ['GET']})
|
|
299
|
m.connect('admin_settings_issuetracker_save',
|
|
295
|
m.connect('admin_settings_issuetracker_save',
|
|
300
|
'/settings/issue-tracker/save',
|
|
296
|
'/settings/issue-tracker/save',
|
|
301
|
action='settings_issuetracker_save',
|
|
297
|
action='settings_issuetracker_save',
|
|
302
|
conditions={'method': ['POST']})
|
|
298
|
conditions={'method': ['POST']})
|
|
303
|
m.connect('admin_issuetracker_test', '/settings/issue-tracker/test',
|
|
299
|
m.connect('admin_issuetracker_test', '/settings/issue-tracker/test',
|
|
304
|
action='settings_issuetracker_test',
|
|
300
|
action='settings_issuetracker_test',
|
|
305
|
conditions={'method': ['POST']})
|
|
301
|
conditions={'method': ['POST']})
|
|
306
|
m.connect('admin_issuetracker_delete',
|
|
302
|
m.connect('admin_issuetracker_delete',
|
|
307
|
'/settings/issue-tracker/delete',
|
|
303
|
'/settings/issue-tracker/delete',
|
|
308
|
action='settings_issuetracker_delete',
|
|
304
|
action='settings_issuetracker_delete',
|
|
309
|
conditions={'method': ['DELETE']})
|
|
305
|
conditions={'method': ['DELETE']})
|
|
310
|
|
|
306
|
|
|
311
|
m.connect('admin_settings_email', '/settings/email',
|
|
307
|
m.connect('admin_settings_email', '/settings/email',
|
|
312
|
action='settings_email_update',
|
|
308
|
action='settings_email_update',
|
|
313
|
conditions={'method': ['POST']})
|
|
309
|
conditions={'method': ['POST']})
|
|
314
|
m.connect('admin_settings_email', '/settings/email',
|
|
310
|
m.connect('admin_settings_email', '/settings/email',
|
|
315
|
action='settings_email', conditions={'method': ['GET']})
|
|
311
|
action='settings_email', conditions={'method': ['GET']})
|
|
316
|
|
|
312
|
|
|
317
|
m.connect('admin_settings_hooks', '/settings/hooks',
|
|
313
|
m.connect('admin_settings_hooks', '/settings/hooks',
|
|
318
|
action='settings_hooks_update',
|
|
314
|
action='settings_hooks_update',
|
|
319
|
conditions={'method': ['POST', 'DELETE']})
|
|
315
|
conditions={'method': ['POST', 'DELETE']})
|
|
320
|
m.connect('admin_settings_hooks', '/settings/hooks',
|
|
316
|
m.connect('admin_settings_hooks', '/settings/hooks',
|
|
321
|
action='settings_hooks', conditions={'method': ['GET']})
|
|
317
|
action='settings_hooks', conditions={'method': ['GET']})
|
|
322
|
|
|
318
|
|
|
323
|
m.connect('admin_settings_search', '/settings/search',
|
|
319
|
m.connect('admin_settings_search', '/settings/search',
|
|
324
|
action='settings_search', conditions={'method': ['GET']})
|
|
320
|
action='settings_search', conditions={'method': ['GET']})
|
|
325
|
|
|
321
|
|
|
326
|
m.connect('admin_settings_supervisor', '/settings/supervisor',
|
|
322
|
m.connect('admin_settings_supervisor', '/settings/supervisor',
|
|
327
|
action='settings_supervisor', conditions={'method': ['GET']})
|
|
323
|
action='settings_supervisor', conditions={'method': ['GET']})
|
|
328
|
m.connect('admin_settings_supervisor_log', '/settings/supervisor/{procid}/log',
|
|
324
|
m.connect('admin_settings_supervisor_log', '/settings/supervisor/{procid}/log',
|
|
329
|
action='settings_supervisor_log', conditions={'method': ['GET']})
|
|
325
|
action='settings_supervisor_log', conditions={'method': ['GET']})
|
|
330
|
|
|
326
|
|
|
331
|
m.connect('admin_settings_labs', '/settings/labs',
|
|
327
|
m.connect('admin_settings_labs', '/settings/labs',
|
|
332
|
action='settings_labs_update',
|
|
328
|
action='settings_labs_update',
|
|
333
|
conditions={'method': ['POST']})
|
|
329
|
conditions={'method': ['POST']})
|
|
334
|
m.connect('admin_settings_labs', '/settings/labs',
|
|
330
|
m.connect('admin_settings_labs', '/settings/labs',
|
|
335
|
action='settings_labs', conditions={'method': ['GET']})
|
|
331
|
action='settings_labs', conditions={'method': ['GET']})
|
|
336
|
|
|
332
|
|
|
337
|
# ADMIN MY ACCOUNT
|
|
333
|
# ADMIN MY ACCOUNT
|
|
338
|
with rmap.submapper(path_prefix=ADMIN_PREFIX,
|
|
334
|
with rmap.submapper(path_prefix=ADMIN_PREFIX,
|
|
339
|
controller='admin/my_account') as m:
|
|
335
|
controller='admin/my_account') as m:
|
|
340
|
|
|
336
|
|
|
341
|
# NOTE(marcink): this needs to be kept for password force flag to be
|
|
337
|
# NOTE(marcink): this needs to be kept for password force flag to be
|
|
342
|
# handled in pylons controllers, remove after full migration to pyramid
|
|
338
|
# handled in pylons controllers, remove after full migration to pyramid
|
|
343
|
m.connect('my_account_password', '/my_account/password',
|
|
339
|
m.connect('my_account_password', '/my_account/password',
|
|
344
|
action='my_account_password', conditions={'method': ['GET']})
|
|
340
|
action='my_account_password', conditions={'method': ['GET']})
|
|
345
|
|
|
341
|
|
|
346
|
|
|
342
|
|
|
347
|
return rmap
|
|
343
|
return rmap
|