Show More
@@ -0,0 +1,55 b'' | |||
|
1 | |RCE| 4.10.5 |RNS| | |
|
2 | ------------------ | |
|
3 | ||
|
4 | Release Date | |
|
5 | ^^^^^^^^^^^^ | |
|
6 | ||
|
7 | - 2017-11-23 | |
|
8 | ||
|
9 | ||
|
10 | New Features | |
|
11 | ^^^^^^^^^^^^ | |
|
12 | ||
|
13 | ||
|
14 | ||
|
15 | General | |
|
16 | ^^^^^^^ | |
|
17 | ||
|
18 | - dependencies: pin against rhodecode-tools 0.13.1. Fixes a cleanup-repos bug. | |
|
19 | ||
|
20 | ||
|
21 | Security | |
|
22 | ^^^^^^^^ | |
|
23 | ||
|
24 | - Pull requests: security(low), check for permissions on exposure of repo-refs. | |
|
25 | Prevents exposure of branches/tags on private repositories. | |
|
26 | - Metatags: limit the scope of url => metatag to http, https and / links. | |
|
27 | Prevents possible JS injection in those types of links which is unsafe. | |
|
28 | ||
|
29 | ||
|
30 | Performance | |
|
31 | ^^^^^^^^^^^ | |
|
32 | ||
|
33 | ||
|
34 | ||
|
35 | Fixes | |
|
36 | ^^^^^ | |
|
37 | ||
|
38 | ||
|
39 | - Emails: fixed validation of emails with whitespace in them. | |
|
40 | - Repo groups: fix bad route redirect on check if user tried to revoke | |
|
41 | permissions on himself. | |
|
42 | - Comments: place the left over comments (outdated/misplaced) to the left or | |
|
43 | right pane in side-by-side diff. | |
|
44 | - Comments: allow to properly initialize outdated comments that are still attached. | |
|
45 | Fixes a problem when outdated TODO notes couldn't be properly resolved. | |
|
46 | - Diffs: fixed problem with rendering no newline at the end of file markers. | |
|
47 | In case of unified diff that would show incorrect diffs in rare cases. | |
|
48 | - Settings: fix potential 500 problem on bad data passed in. | |
|
49 | ||
|
50 | ||
|
51 | Upgrade notes | |
|
52 | ^^^^^^^^^^^^^ | |
|
53 | ||
|
54 | - Fixes regression in nested repository groups update. No upgrade problems should | |
|
55 | be expected |
@@ -1,28 +1,29 b'' | |||
|
1 | 1 | 1bd3e92b7e2e2d2024152b34bb88dff1db544a71 v4.0.0 |
|
2 | 2 | 170c5398320ea6cddd50955e88d408794c21d43a v4.0.1 |
|
3 | 3 | c3fe200198f5aa34cf2e4066df2881a9cefe3704 v4.1.0 |
|
4 | 4 | 7fd5c850745e2ea821fb4406af5f4bff9b0a7526 v4.1.1 |
|
5 | 5 | 41c87da28a179953df86061d817bc35533c66dd2 v4.1.2 |
|
6 | 6 | baaf9f5bcea3bae0ef12ae20c8b270482e62abb6 v4.2.0 |
|
7 | 7 | 32a70c7e56844a825f61df496ee5eaf8c3c4e189 v4.2.1 |
|
8 | 8 | fa695cdb411d294679ac081d595ac654e5613b03 v4.3.0 |
|
9 | 9 | 0e4dc11b58cad833c513fe17bac39e6850edf959 v4.3.1 |
|
10 | 10 | 8a876f48f5cb1d018b837db28ff928500cb32cfb v4.4.0 |
|
11 | 11 | 8dd86b410b1aac086ffdfc524ef300f896af5047 v4.4.1 |
|
12 | 12 | d2514226abc8d3b4f6fb57765f47d1b6fb360a05 v4.4.2 |
|
13 | 13 | 27d783325930af6dad2741476c0d0b1b7c8415c2 v4.5.0 |
|
14 | 14 | 7f2016f352abcbdba4a19d4039c386e9629449da v4.5.1 |
|
15 | 15 | 416fec799314c70a5c780fb28b3357b08869333a v4.5.2 |
|
16 | 16 | 27c3b85fafc83143e6678fbc3da69e1615bcac55 v4.6.0 |
|
17 | 17 | 5ad13deb9118c2a5243d4032d4d9cc174e5872db v4.6.1 |
|
18 | 18 | 2be921e01fa24bb102696ada596f87464c3666f6 v4.7.0 |
|
19 | 19 | 7198bdec29c2872c974431d55200d0398354cdb1 v4.7.1 |
|
20 | 20 | bd1c8d230fe741c2dfd7100a0ef39fd0774fd581 v4.7.2 |
|
21 | 21 | 9731914f89765d9628dc4dddc84bc9402aa124c8 v4.8.0 |
|
22 | 22 | c5a2b7d0e4bbdebc4a62d7b624befe375207b659 v4.9.0 |
|
23 | 23 | d9aa3b27ac9f7e78359775c75fedf7bfece232f1 v4.9.1 |
|
24 | 24 | 4ba4d74981cec5d6b28b158f875a2540952c2f74 v4.10.0 |
|
25 | 25 | 0a6821cbd6b0b3c21503002f88800679fa35ab63 v4.10.1 |
|
26 | 26 | 434ad90ec8d621f4416074b84f6e9ce03964defb v4.10.2 |
|
27 | 27 | 68baee10e698da2724c6e0f698c03a6abb993bf2 v4.10.3 |
|
28 | 28 | 00821d3afd1dce3f4767cc353f84a17f7d5218a1 v4.10.4 |
|
29 | 22f6744ad8cc274311825f63f953e4dee2ea5cb9 v4.10.5 |
@@ -1,105 +1,106 b'' | |||
|
1 | 1 | .. _rhodecode-release-notes-ref: |
|
2 | 2 | |
|
3 | 3 | Release Notes |
|
4 | 4 | ============= |
|
5 | 5 | |
|
6 | 6 | |RCE| 4.x Versions |
|
7 | 7 | ------------------ |
|
8 | 8 | |
|
9 | 9 | .. toctree:: |
|
10 | 10 | :maxdepth: 1 |
|
11 | 11 | |
|
12 | release-notes-4.10.5.rst | |
|
12 | 13 | release-notes-4.10.4.rst |
|
13 | 14 | release-notes-4.10.3.rst |
|
14 | 15 | release-notes-4.10.2.rst |
|
15 | 16 | release-notes-4.10.1.rst |
|
16 | 17 | release-notes-4.10.0.rst |
|
17 | 18 | release-notes-4.9.1.rst |
|
18 | 19 | release-notes-4.9.0.rst |
|
19 | 20 | release-notes-4.8.0.rst |
|
20 | 21 | release-notes-4.7.2.rst |
|
21 | 22 | release-notes-4.7.1.rst |
|
22 | 23 | release-notes-4.7.0.rst |
|
23 | 24 | release-notes-4.6.1.rst |
|
24 | 25 | release-notes-4.6.0.rst |
|
25 | 26 | release-notes-4.5.2.rst |
|
26 | 27 | release-notes-4.5.1.rst |
|
27 | 28 | release-notes-4.5.0.rst |
|
28 | 29 | release-notes-4.4.2.rst |
|
29 | 30 | release-notes-4.4.1.rst |
|
30 | 31 | release-notes-4.4.0.rst |
|
31 | 32 | release-notes-4.3.1.rst |
|
32 | 33 | release-notes-4.3.0.rst |
|
33 | 34 | release-notes-4.2.1.rst |
|
34 | 35 | release-notes-4.2.0.rst |
|
35 | 36 | release-notes-4.1.2.rst |
|
36 | 37 | release-notes-4.1.1.rst |
|
37 | 38 | release-notes-4.1.0.rst |
|
38 | 39 | release-notes-4.0.1.rst |
|
39 | 40 | release-notes-4.0.0.rst |
|
40 | 41 | |
|
41 | 42 | |RCE| 3.x Versions |
|
42 | 43 | ------------------ |
|
43 | 44 | |
|
44 | 45 | .. toctree:: |
|
45 | 46 | :maxdepth: 1 |
|
46 | 47 | |
|
47 | 48 | release-notes-3.8.4.rst |
|
48 | 49 | release-notes-3.8.3.rst |
|
49 | 50 | release-notes-3.8.2.rst |
|
50 | 51 | release-notes-3.8.1.rst |
|
51 | 52 | release-notes-3.8.0.rst |
|
52 | 53 | release-notes-3.7.1.rst |
|
53 | 54 | release-notes-3.7.0.rst |
|
54 | 55 | release-notes-3.6.1.rst |
|
55 | 56 | release-notes-3.6.0.rst |
|
56 | 57 | release-notes-3.5.2.rst |
|
57 | 58 | release-notes-3.5.1.rst |
|
58 | 59 | release-notes-3.5.0.rst |
|
59 | 60 | release-notes-3.4.1.rst |
|
60 | 61 | release-notes-3.4.0.rst |
|
61 | 62 | release-notes-3.3.4.rst |
|
62 | 63 | release-notes-3.3.3.rst |
|
63 | 64 | release-notes-3.3.2.rst |
|
64 | 65 | release-notes-3.3.1.rst |
|
65 | 66 | release-notes-3.3.0.rst |
|
66 | 67 | release-notes-3.2.3.rst |
|
67 | 68 | release-notes-3.2.2.rst |
|
68 | 69 | release-notes-3.2.1.rst |
|
69 | 70 | release-notes-3.2.0.rst |
|
70 | 71 | release-notes-3.1.1.rst |
|
71 | 72 | release-notes-3.1.0.rst |
|
72 | 73 | release-notes-3.0.2.rst |
|
73 | 74 | release-notes-3.0.1.rst |
|
74 | 75 | release-notes-3.0.0.rst |
|
75 | 76 | |
|
76 | 77 | |RCE| 2.x Versions |
|
77 | 78 | ------------------ |
|
78 | 79 | |
|
79 | 80 | .. toctree:: |
|
80 | 81 | :maxdepth: 1 |
|
81 | 82 | |
|
82 | 83 | release-notes-2.2.8.rst |
|
83 | 84 | release-notes-2.2.7.rst |
|
84 | 85 | release-notes-2.2.6.rst |
|
85 | 86 | release-notes-2.2.5.rst |
|
86 | 87 | release-notes-2.2.4.rst |
|
87 | 88 | release-notes-2.2.3.rst |
|
88 | 89 | release-notes-2.2.2.rst |
|
89 | 90 | release-notes-2.2.1.rst |
|
90 | 91 | release-notes-2.2.0.rst |
|
91 | 92 | release-notes-2.1.0.rst |
|
92 | 93 | release-notes-2.0.2.rst |
|
93 | 94 | release-notes-2.0.1.rst |
|
94 | 95 | release-notes-2.0.0.rst |
|
95 | 96 | |
|
96 | 97 | |RCE| 1.x Versions |
|
97 | 98 | ------------------ |
|
98 | 99 | |
|
99 | 100 | .. toctree:: |
|
100 | 101 | :maxdepth: 1 |
|
101 | 102 | |
|
102 | 103 | release-notes-1.7.2.rst |
|
103 | 104 | release-notes-1.7.1.rst |
|
104 | 105 | release-notes-1.7.0.rst |
|
105 | 106 | release-notes-1.6.0.rst |
@@ -1,617 +1,614 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | |
|
3 | 3 | # Copyright (C) 2010-2017 RhodeCode GmbH |
|
4 | 4 | # |
|
5 | 5 | # This program is free software: you can redistribute it and/or modify |
|
6 | 6 | # it under the terms of the GNU Affero General Public License, version 3 |
|
7 | 7 | # (only), as published by the Free Software Foundation. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU Affero General Public License |
|
15 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 | 16 | # |
|
17 | 17 | # This program is dual-licensed. If you wish to learn more about the |
|
18 | 18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
19 | 19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
20 | 20 | |
|
21 | 21 | """ |
|
22 | 22 | this is forms validation classes |
|
23 | 23 | http://formencode.org/module-formencode.validators.html |
|
24 | 24 | for list off all availible validators |
|
25 | 25 | |
|
26 | 26 | we can create our own validators |
|
27 | 27 | |
|
28 | 28 | The table below outlines the options which can be used in a schema in addition to the validators themselves |
|
29 | 29 | pre_validators [] These validators will be applied before the schema |
|
30 | 30 | chained_validators [] These validators will be applied after the schema |
|
31 | 31 | allow_extra_fields False If True, then it is not an error when keys that aren't associated with a validator are present |
|
32 | 32 | filter_extra_fields False If True, then keys that aren't associated with a validator are removed |
|
33 | 33 | if_key_missing NoDefault If this is given, then any keys that aren't available but are expected will be replaced with this value (and then validated). This does not override a present .if_missing attribute on validators. NoDefault is a special FormEncode class to mean that no default values has been specified and therefore missing keys shouldn't take a default value. |
|
34 | 34 | ignore_key_missing False If True, then missing keys will be missing in the result, if the validator doesn't have .if_missing on it already |
|
35 | 35 | |
|
36 | 36 | |
|
37 | 37 | <name> = formencode.validators.<name of validator> |
|
38 | 38 | <name> must equal form name |
|
39 | 39 | list=[1,2,3,4,5] |
|
40 | 40 | for SELECT use formencode.All(OneOf(list), Int()) |
|
41 | 41 | |
|
42 | 42 | """ |
|
43 | 43 | |
|
44 | 44 | import deform |
|
45 | 45 | import logging |
|
46 | 46 | import formencode |
|
47 | 47 | |
|
48 | 48 | from pkg_resources import resource_filename |
|
49 | 49 | from formencode import All, Pipe |
|
50 | 50 | |
|
51 | 51 | from pyramid.threadlocal import get_current_request |
|
52 | 52 | |
|
53 | 53 | from rhodecode import BACKENDS |
|
54 | 54 | from rhodecode.lib import helpers |
|
55 | 55 | from rhodecode.model import validators as v |
|
56 | 56 | |
|
57 | 57 | log = logging.getLogger(__name__) |
|
58 | 58 | |
|
59 | 59 | |
|
60 | 60 | deform_templates = resource_filename('deform', 'templates') |
|
61 | 61 | rhodecode_templates = resource_filename('rhodecode', 'templates/forms') |
|
62 | 62 | search_path = (rhodecode_templates, deform_templates) |
|
63 | 63 | |
|
64 | 64 | |
|
65 | 65 | class RhodecodeFormZPTRendererFactory(deform.ZPTRendererFactory): |
|
66 | 66 | """ Subclass of ZPTRendererFactory to add rhodecode context variables """ |
|
67 | 67 | def __call__(self, template_name, **kw): |
|
68 | 68 | kw['h'] = helpers |
|
69 | 69 | kw['request'] = get_current_request() |
|
70 | 70 | return self.load(template_name)(**kw) |
|
71 | 71 | |
|
72 | 72 | |
|
73 | 73 | form_renderer = RhodecodeFormZPTRendererFactory(search_path) |
|
74 | 74 | deform.Form.set_default_renderer(form_renderer) |
|
75 | 75 | |
|
76 | 76 | |
|
77 | 77 | def LoginForm(localizer): |
|
78 | 78 | _ = localizer |
|
79 | 79 | |
|
80 | 80 | class _LoginForm(formencode.Schema): |
|
81 | 81 | allow_extra_fields = True |
|
82 | 82 | filter_extra_fields = True |
|
83 | 83 | username = v.UnicodeString( |
|
84 | 84 | strip=True, |
|
85 | 85 | min=1, |
|
86 | 86 | not_empty=True, |
|
87 | 87 | messages={ |
|
88 | 88 | 'empty': _(u'Please enter a login'), |
|
89 | 89 | 'tooShort': _(u'Enter a value %(min)i characters long or more') |
|
90 | 90 | } |
|
91 | 91 | ) |
|
92 | 92 | |
|
93 | 93 | password = v.UnicodeString( |
|
94 | 94 | strip=False, |
|
95 | 95 | min=3, |
|
96 | 96 | max=72, |
|
97 | 97 | not_empty=True, |
|
98 | 98 | messages={ |
|
99 | 99 | 'empty': _(u'Please enter a password'), |
|
100 | 100 | 'tooShort': _(u'Enter %(min)i characters or more')} |
|
101 | 101 | ) |
|
102 | 102 | |
|
103 | 103 | remember = v.StringBoolean(if_missing=False) |
|
104 | 104 | |
|
105 | 105 | chained_validators = [v.ValidAuth(localizer)] |
|
106 | 106 | return _LoginForm |
|
107 | 107 | |
|
108 | 108 | |
|
109 | 109 | def UserForm(localizer, edit=False, available_languages=None, old_data=None): |
|
110 | 110 | old_data = old_data or {} |
|
111 | 111 | available_languages = available_languages or [] |
|
112 | 112 | _ = localizer |
|
113 | 113 | |
|
114 | 114 | class _UserForm(formencode.Schema): |
|
115 | 115 | allow_extra_fields = True |
|
116 | 116 | filter_extra_fields = True |
|
117 | 117 | username = All(v.UnicodeString(strip=True, min=1, not_empty=True), |
|
118 | 118 | v.ValidUsername(localizer, edit, old_data)) |
|
119 | 119 | if edit: |
|
120 | 120 | new_password = All( |
|
121 | 121 | v.ValidPassword(localizer), |
|
122 | 122 | v.UnicodeString(strip=False, min=6, max=72, not_empty=False) |
|
123 | 123 | ) |
|
124 | 124 | password_confirmation = All( |
|
125 | 125 | v.ValidPassword(localizer), |
|
126 | 126 | v.UnicodeString(strip=False, min=6, max=72, not_empty=False), |
|
127 | 127 | ) |
|
128 | 128 | admin = v.StringBoolean(if_missing=False) |
|
129 | 129 | else: |
|
130 | 130 | password = All( |
|
131 | 131 | v.ValidPassword(localizer), |
|
132 | 132 | v.UnicodeString(strip=False, min=6, max=72, not_empty=True) |
|
133 | 133 | ) |
|
134 | 134 | password_confirmation = All( |
|
135 | 135 | v.ValidPassword(localizer), |
|
136 | 136 | v.UnicodeString(strip=False, min=6, max=72, not_empty=False) |
|
137 | 137 | ) |
|
138 | 138 | |
|
139 | 139 | password_change = v.StringBoolean(if_missing=False) |
|
140 | 140 | create_repo_group = v.StringBoolean(if_missing=False) |
|
141 | 141 | |
|
142 | 142 | active = v.StringBoolean(if_missing=False) |
|
143 | 143 | firstname = v.UnicodeString(strip=True, min=1, not_empty=False) |
|
144 | 144 | lastname = v.UnicodeString(strip=True, min=1, not_empty=False) |
|
145 |
email = All(v. |
|
|
145 | email = All(v.UniqSystemEmail(localizer, old_data), v.Email(not_empty=True)) | |
|
146 | 146 | extern_name = v.UnicodeString(strip=True) |
|
147 | 147 | extern_type = v.UnicodeString(strip=True) |
|
148 | 148 | language = v.OneOf(available_languages, hideList=False, |
|
149 | 149 | testValueList=True, if_missing=None) |
|
150 | 150 | chained_validators = [v.ValidPasswordsMatch(localizer)] |
|
151 | 151 | return _UserForm |
|
152 | 152 | |
|
153 | 153 | |
|
154 | 154 | def UserGroupForm(localizer, edit=False, old_data=None, allow_disabled=False): |
|
155 | 155 | old_data = old_data or {} |
|
156 | 156 | _ = localizer |
|
157 | 157 | |
|
158 | 158 | class _UserGroupForm(formencode.Schema): |
|
159 | 159 | allow_extra_fields = True |
|
160 | 160 | filter_extra_fields = True |
|
161 | 161 | |
|
162 | 162 | users_group_name = All( |
|
163 | 163 | v.UnicodeString(strip=True, min=1, not_empty=True), |
|
164 | 164 | v.ValidUserGroup(localizer, edit, old_data) |
|
165 | 165 | ) |
|
166 | 166 | user_group_description = v.UnicodeString(strip=True, min=1, |
|
167 | 167 | not_empty=False) |
|
168 | 168 | |
|
169 | 169 | users_group_active = v.StringBoolean(if_missing=False) |
|
170 | 170 | |
|
171 | 171 | if edit: |
|
172 | 172 | # this is user group owner |
|
173 | 173 | user = All( |
|
174 | 174 | v.UnicodeString(not_empty=True), |
|
175 | 175 | v.ValidRepoUser(localizer, allow_disabled)) |
|
176 | 176 | return _UserGroupForm |
|
177 | 177 | |
|
178 | 178 | |
|
179 | 179 | def RepoGroupForm(localizer, edit=False, old_data=None, available_groups=None, |
|
180 | 180 | can_create_in_root=False, allow_disabled=False): |
|
181 | 181 | _ = localizer |
|
182 | 182 | old_data = old_data or {} |
|
183 | 183 | available_groups = available_groups or [] |
|
184 | 184 | |
|
185 | 185 | class _RepoGroupForm(formencode.Schema): |
|
186 | 186 | allow_extra_fields = True |
|
187 | 187 | filter_extra_fields = False |
|
188 | 188 | |
|
189 | 189 | group_name = All(v.UnicodeString(strip=True, min=1, not_empty=True), |
|
190 | 190 | v.SlugifyName(localizer),) |
|
191 | 191 | group_description = v.UnicodeString(strip=True, min=1, |
|
192 | 192 | not_empty=False) |
|
193 | 193 | group_copy_permissions = v.StringBoolean(if_missing=False) |
|
194 | 194 | |
|
195 | 195 | group_parent_id = v.OneOf(available_groups, hideList=False, |
|
196 | 196 | testValueList=True, not_empty=True) |
|
197 | 197 | enable_locking = v.StringBoolean(if_missing=False) |
|
198 | 198 | chained_validators = [ |
|
199 | 199 | v.ValidRepoGroup(localizer, edit, old_data, can_create_in_root)] |
|
200 | 200 | |
|
201 | 201 | if edit: |
|
202 | 202 | # this is repo group owner |
|
203 | 203 | user = All( |
|
204 | 204 | v.UnicodeString(not_empty=True), |
|
205 | 205 | v.ValidRepoUser(localizer, allow_disabled)) |
|
206 | 206 | return _RepoGroupForm |
|
207 | 207 | |
|
208 | 208 | |
|
209 | 209 | def RegisterForm(localizer, edit=False, old_data=None): |
|
210 | 210 | _ = localizer |
|
211 | 211 | old_data = old_data or {} |
|
212 | 212 | |
|
213 | 213 | class _RegisterForm(formencode.Schema): |
|
214 | 214 | allow_extra_fields = True |
|
215 | 215 | filter_extra_fields = True |
|
216 | 216 | username = All( |
|
217 | 217 | v.ValidUsername(localizer, edit, old_data), |
|
218 | 218 | v.UnicodeString(strip=True, min=1, not_empty=True) |
|
219 | 219 | ) |
|
220 | 220 | password = All( |
|
221 | 221 | v.ValidPassword(localizer), |
|
222 | 222 | v.UnicodeString(strip=False, min=6, max=72, not_empty=True) |
|
223 | 223 | ) |
|
224 | 224 | password_confirmation = All( |
|
225 | 225 | v.ValidPassword(localizer), |
|
226 | 226 | v.UnicodeString(strip=False, min=6, max=72, not_empty=True) |
|
227 | 227 | ) |
|
228 | 228 | active = v.StringBoolean(if_missing=False) |
|
229 | 229 | firstname = v.UnicodeString(strip=True, min=1, not_empty=False) |
|
230 | 230 | lastname = v.UnicodeString(strip=True, min=1, not_empty=False) |
|
231 | email = All( | |
|
232 | v.Email(not_empty=True), | |
|
233 | v.UniqSystemEmail(localizer, old_data), | |
|
234 | v.UnicodeString(strip=True, min=3)) | |
|
231 | email = All(v.UniqSystemEmail(localizer, old_data), v.Email(not_empty=True)) | |
|
235 | 232 | |
|
236 | 233 | chained_validators = [v.ValidPasswordsMatch(localizer)] |
|
237 | 234 | return _RegisterForm |
|
238 | 235 | |
|
239 | 236 | |
|
240 | 237 | def PasswordResetForm(localizer): |
|
241 | 238 | _ = localizer |
|
242 | 239 | |
|
243 | 240 | class _PasswordResetForm(formencode.Schema): |
|
244 | 241 | allow_extra_fields = True |
|
245 | 242 | filter_extra_fields = True |
|
246 | 243 | email = All(v.ValidSystemEmail(localizer), v.Email(not_empty=True)) |
|
247 | 244 | return _PasswordResetForm |
|
248 | 245 | |
|
249 | 246 | |
|
250 | 247 | def RepoForm(localizer, edit=False, old_data=None, repo_groups=None, |
|
251 | 248 | landing_revs=None, allow_disabled=False): |
|
252 | 249 | _ = localizer |
|
253 | 250 | old_data = old_data or {} |
|
254 | 251 | repo_groups = repo_groups or [] |
|
255 | 252 | landing_revs = landing_revs or [] |
|
256 | 253 | supported_backends = BACKENDS.keys() |
|
257 | 254 | |
|
258 | 255 | class _RepoForm(formencode.Schema): |
|
259 | 256 | allow_extra_fields = True |
|
260 | 257 | filter_extra_fields = False |
|
261 | 258 | repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True), |
|
262 | 259 | v.SlugifyName(localizer), v.CannotHaveGitSuffix(localizer)) |
|
263 | 260 | repo_group = All(v.CanWriteGroup(localizer, old_data), |
|
264 | 261 | v.OneOf(repo_groups, hideList=True)) |
|
265 | 262 | repo_type = v.OneOf(supported_backends, required=False, |
|
266 | 263 | if_missing=old_data.get('repo_type')) |
|
267 | 264 | repo_description = v.UnicodeString(strip=True, min=1, not_empty=False) |
|
268 | 265 | repo_private = v.StringBoolean(if_missing=False) |
|
269 | 266 | repo_landing_rev = v.OneOf(landing_revs, hideList=True) |
|
270 | 267 | repo_copy_permissions = v.StringBoolean(if_missing=False) |
|
271 | 268 | clone_uri = All(v.UnicodeString(strip=True, min=1, not_empty=False)) |
|
272 | 269 | |
|
273 | 270 | repo_enable_statistics = v.StringBoolean(if_missing=False) |
|
274 | 271 | repo_enable_downloads = v.StringBoolean(if_missing=False) |
|
275 | 272 | repo_enable_locking = v.StringBoolean(if_missing=False) |
|
276 | 273 | |
|
277 | 274 | if edit: |
|
278 | 275 | # this is repo owner |
|
279 | 276 | user = All( |
|
280 | 277 | v.UnicodeString(not_empty=True), |
|
281 | 278 | v.ValidRepoUser(localizer, allow_disabled)) |
|
282 | 279 | clone_uri_change = v.UnicodeString( |
|
283 | 280 | not_empty=False, if_missing=v.Missing) |
|
284 | 281 | |
|
285 | 282 | chained_validators = [v.ValidCloneUri(localizer), |
|
286 | 283 | v.ValidRepoName(localizer, edit, old_data)] |
|
287 | 284 | return _RepoForm |
|
288 | 285 | |
|
289 | 286 | |
|
290 | 287 | def RepoPermsForm(localizer): |
|
291 | 288 | _ = localizer |
|
292 | 289 | |
|
293 | 290 | class _RepoPermsForm(formencode.Schema): |
|
294 | 291 | allow_extra_fields = True |
|
295 | 292 | filter_extra_fields = False |
|
296 | 293 | chained_validators = [v.ValidPerms(localizer, type_='repo')] |
|
297 | 294 | return _RepoPermsForm |
|
298 | 295 | |
|
299 | 296 | |
|
300 | 297 | def RepoGroupPermsForm(localizer, valid_recursive_choices): |
|
301 | 298 | _ = localizer |
|
302 | 299 | |
|
303 | 300 | class _RepoGroupPermsForm(formencode.Schema): |
|
304 | 301 | allow_extra_fields = True |
|
305 | 302 | filter_extra_fields = False |
|
306 | 303 | recursive = v.OneOf(valid_recursive_choices) |
|
307 | 304 | chained_validators = [v.ValidPerms(localizer, type_='repo_group')] |
|
308 | 305 | return _RepoGroupPermsForm |
|
309 | 306 | |
|
310 | 307 | |
|
311 | 308 | def UserGroupPermsForm(localizer): |
|
312 | 309 | _ = localizer |
|
313 | 310 | |
|
314 | 311 | class _UserPermsForm(formencode.Schema): |
|
315 | 312 | allow_extra_fields = True |
|
316 | 313 | filter_extra_fields = False |
|
317 | 314 | chained_validators = [v.ValidPerms(localizer, type_='user_group')] |
|
318 | 315 | return _UserPermsForm |
|
319 | 316 | |
|
320 | 317 | |
|
321 | 318 | def RepoFieldForm(localizer): |
|
322 | 319 | _ = localizer |
|
323 | 320 | |
|
324 | 321 | class _RepoFieldForm(formencode.Schema): |
|
325 | 322 | filter_extra_fields = True |
|
326 | 323 | allow_extra_fields = True |
|
327 | 324 | |
|
328 | 325 | new_field_key = All(v.FieldKey(localizer), |
|
329 | 326 | v.UnicodeString(strip=True, min=3, not_empty=True)) |
|
330 | 327 | new_field_value = v.UnicodeString(not_empty=False, if_missing=u'') |
|
331 | 328 | new_field_type = v.OneOf(['str', 'unicode', 'list', 'tuple'], |
|
332 | 329 | if_missing='str') |
|
333 | 330 | new_field_label = v.UnicodeString(not_empty=False) |
|
334 | 331 | new_field_desc = v.UnicodeString(not_empty=False) |
|
335 | 332 | return _RepoFieldForm |
|
336 | 333 | |
|
337 | 334 | |
|
338 | 335 | def RepoForkForm(localizer, edit=False, old_data=None, |
|
339 | 336 | supported_backends=BACKENDS.keys(), repo_groups=None, |
|
340 | 337 | landing_revs=None): |
|
341 | 338 | _ = localizer |
|
342 | 339 | old_data = old_data or {} |
|
343 | 340 | repo_groups = repo_groups or [] |
|
344 | 341 | landing_revs = landing_revs or [] |
|
345 | 342 | |
|
346 | 343 | class _RepoForkForm(formencode.Schema): |
|
347 | 344 | allow_extra_fields = True |
|
348 | 345 | filter_extra_fields = False |
|
349 | 346 | repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True), |
|
350 | 347 | v.SlugifyName(localizer)) |
|
351 | 348 | repo_group = All(v.CanWriteGroup(localizer, ), |
|
352 | 349 | v.OneOf(repo_groups, hideList=True)) |
|
353 | 350 | repo_type = All(v.ValidForkType(localizer, old_data), v.OneOf(supported_backends)) |
|
354 | 351 | description = v.UnicodeString(strip=True, min=1, not_empty=True) |
|
355 | 352 | private = v.StringBoolean(if_missing=False) |
|
356 | 353 | copy_permissions = v.StringBoolean(if_missing=False) |
|
357 | 354 | fork_parent_id = v.UnicodeString() |
|
358 | 355 | chained_validators = [v.ValidForkName(localizer, edit, old_data)] |
|
359 | 356 | landing_rev = v.OneOf(landing_revs, hideList=True) |
|
360 | 357 | return _RepoForkForm |
|
361 | 358 | |
|
362 | 359 | |
|
363 | 360 | def ApplicationSettingsForm(localizer): |
|
364 | 361 | _ = localizer |
|
365 | 362 | |
|
366 | 363 | class _ApplicationSettingsForm(formencode.Schema): |
|
367 | 364 | allow_extra_fields = True |
|
368 | 365 | filter_extra_fields = False |
|
369 | 366 | rhodecode_title = v.UnicodeString(strip=True, max=40, not_empty=False) |
|
370 | 367 | rhodecode_realm = v.UnicodeString(strip=True, min=1, not_empty=True) |
|
371 | 368 | rhodecode_pre_code = v.UnicodeString(strip=True, min=1, not_empty=False) |
|
372 | 369 | rhodecode_post_code = v.UnicodeString(strip=True, min=1, not_empty=False) |
|
373 | 370 | rhodecode_captcha_public_key = v.UnicodeString(strip=True, min=1, not_empty=False) |
|
374 | 371 | rhodecode_captcha_private_key = v.UnicodeString(strip=True, min=1, not_empty=False) |
|
375 | 372 | rhodecode_create_personal_repo_group = v.StringBoolean(if_missing=False) |
|
376 | 373 | rhodecode_personal_repo_group_pattern = v.UnicodeString(strip=True, min=1, not_empty=False) |
|
377 | 374 | return _ApplicationSettingsForm |
|
378 | 375 | |
|
379 | 376 | |
|
380 | 377 | def ApplicationVisualisationForm(localizer): |
|
381 | 378 | _ = localizer |
|
382 | 379 | |
|
383 | 380 | class _ApplicationVisualisationForm(formencode.Schema): |
|
384 | 381 | allow_extra_fields = True |
|
385 | 382 | filter_extra_fields = False |
|
386 | 383 | rhodecode_show_public_icon = v.StringBoolean(if_missing=False) |
|
387 | 384 | rhodecode_show_private_icon = v.StringBoolean(if_missing=False) |
|
388 | 385 | rhodecode_stylify_metatags = v.StringBoolean(if_missing=False) |
|
389 | 386 | |
|
390 | 387 | rhodecode_repository_fields = v.StringBoolean(if_missing=False) |
|
391 | 388 | rhodecode_lightweight_journal = v.StringBoolean(if_missing=False) |
|
392 | 389 | rhodecode_dashboard_items = v.Int(min=5, not_empty=True) |
|
393 | 390 | rhodecode_admin_grid_items = v.Int(min=5, not_empty=True) |
|
394 | 391 | rhodecode_show_version = v.StringBoolean(if_missing=False) |
|
395 | 392 | rhodecode_use_gravatar = v.StringBoolean(if_missing=False) |
|
396 | 393 | rhodecode_markup_renderer = v.OneOf(['markdown', 'rst']) |
|
397 | 394 | rhodecode_gravatar_url = v.UnicodeString(min=3) |
|
398 | 395 | rhodecode_clone_uri_tmpl = v.UnicodeString(min=3) |
|
399 | 396 | rhodecode_support_url = v.UnicodeString() |
|
400 | 397 | rhodecode_show_revision_number = v.StringBoolean(if_missing=False) |
|
401 | 398 | rhodecode_show_sha_length = v.Int(min=4, not_empty=True) |
|
402 | 399 | return _ApplicationVisualisationForm |
|
403 | 400 | |
|
404 | 401 | |
|
405 | 402 | class _BaseVcsSettingsForm(formencode.Schema): |
|
406 | 403 | |
|
407 | 404 | allow_extra_fields = True |
|
408 | 405 | filter_extra_fields = False |
|
409 | 406 | hooks_changegroup_repo_size = v.StringBoolean(if_missing=False) |
|
410 | 407 | hooks_changegroup_push_logger = v.StringBoolean(if_missing=False) |
|
411 | 408 | hooks_outgoing_pull_logger = v.StringBoolean(if_missing=False) |
|
412 | 409 | |
|
413 | 410 | # PR/Code-review |
|
414 | 411 | rhodecode_pr_merge_enabled = v.StringBoolean(if_missing=False) |
|
415 | 412 | rhodecode_use_outdated_comments = v.StringBoolean(if_missing=False) |
|
416 | 413 | |
|
417 | 414 | # hg |
|
418 | 415 | extensions_largefiles = v.StringBoolean(if_missing=False) |
|
419 | 416 | extensions_evolve = v.StringBoolean(if_missing=False) |
|
420 | 417 | phases_publish = v.StringBoolean(if_missing=False) |
|
421 | 418 | |
|
422 | 419 | rhodecode_hg_use_rebase_for_merging = v.StringBoolean(if_missing=False) |
|
423 | 420 | rhodecode_hg_close_branch_before_merging = v.StringBoolean(if_missing=False) |
|
424 | 421 | |
|
425 | 422 | # git |
|
426 | 423 | vcs_git_lfs_enabled = v.StringBoolean(if_missing=False) |
|
427 | 424 | rhodecode_git_use_rebase_for_merging = v.StringBoolean(if_missing=False) |
|
428 | 425 | rhodecode_git_close_branch_before_merging = v.StringBoolean(if_missing=False) |
|
429 | 426 | |
|
430 | 427 | # svn |
|
431 | 428 | vcs_svn_proxy_http_requests_enabled = v.StringBoolean(if_missing=False) |
|
432 | 429 | vcs_svn_proxy_http_server_url = v.UnicodeString(strip=True, if_missing=None) |
|
433 | 430 | |
|
434 | 431 | |
|
435 | 432 | def ApplicationUiSettingsForm(localizer): |
|
436 | 433 | _ = localizer |
|
437 | 434 | |
|
438 | 435 | class _ApplicationUiSettingsForm(_BaseVcsSettingsForm): |
|
439 | 436 | web_push_ssl = v.StringBoolean(if_missing=False) |
|
440 | 437 | paths_root_path = All( |
|
441 | 438 | v.ValidPath(localizer), |
|
442 | 439 | v.UnicodeString(strip=True, min=1, not_empty=True) |
|
443 | 440 | ) |
|
444 | 441 | largefiles_usercache = All( |
|
445 | 442 | v.ValidPath(localizer), |
|
446 | 443 | v.UnicodeString(strip=True, min=2, not_empty=True)) |
|
447 | 444 | vcs_git_lfs_store_location = All( |
|
448 | 445 | v.ValidPath(localizer), |
|
449 | 446 | v.UnicodeString(strip=True, min=2, not_empty=True)) |
|
450 | 447 | extensions_hgsubversion = v.StringBoolean(if_missing=False) |
|
451 | 448 | extensions_hggit = v.StringBoolean(if_missing=False) |
|
452 | 449 | new_svn_branch = v.ValidSvnPattern(localizer, section='vcs_svn_branch') |
|
453 | 450 | new_svn_tag = v.ValidSvnPattern(localizer, section='vcs_svn_tag') |
|
454 | 451 | return _ApplicationUiSettingsForm |
|
455 | 452 | |
|
456 | 453 | |
|
457 | 454 | def RepoVcsSettingsForm(localizer, repo_name): |
|
458 | 455 | _ = localizer |
|
459 | 456 | |
|
460 | 457 | class _RepoVcsSettingsForm(_BaseVcsSettingsForm): |
|
461 | 458 | inherit_global_settings = v.StringBoolean(if_missing=False) |
|
462 | 459 | new_svn_branch = v.ValidSvnPattern(localizer, |
|
463 | 460 | section='vcs_svn_branch', repo_name=repo_name) |
|
464 | 461 | new_svn_tag = v.ValidSvnPattern(localizer, |
|
465 | 462 | section='vcs_svn_tag', repo_name=repo_name) |
|
466 | 463 | return _RepoVcsSettingsForm |
|
467 | 464 | |
|
468 | 465 | |
|
469 | 466 | def LabsSettingsForm(localizer): |
|
470 | 467 | _ = localizer |
|
471 | 468 | |
|
472 | 469 | class _LabSettingsForm(formencode.Schema): |
|
473 | 470 | allow_extra_fields = True |
|
474 | 471 | filter_extra_fields = False |
|
475 | 472 | return _LabSettingsForm |
|
476 | 473 | |
|
477 | 474 | |
|
478 | 475 | def ApplicationPermissionsForm( |
|
479 | 476 | localizer, register_choices, password_reset_choices, |
|
480 | 477 | extern_activate_choices): |
|
481 | 478 | _ = localizer |
|
482 | 479 | |
|
483 | 480 | class _DefaultPermissionsForm(formencode.Schema): |
|
484 | 481 | allow_extra_fields = True |
|
485 | 482 | filter_extra_fields = True |
|
486 | 483 | |
|
487 | 484 | anonymous = v.StringBoolean(if_missing=False) |
|
488 | 485 | default_register = v.OneOf(register_choices) |
|
489 | 486 | default_register_message = v.UnicodeString() |
|
490 | 487 | default_password_reset = v.OneOf(password_reset_choices) |
|
491 | 488 | default_extern_activate = v.OneOf(extern_activate_choices) |
|
492 | 489 | return _DefaultPermissionsForm |
|
493 | 490 | |
|
494 | 491 | |
|
495 | 492 | def ObjectPermissionsForm(localizer, repo_perms_choices, group_perms_choices, |
|
496 | 493 | user_group_perms_choices): |
|
497 | 494 | _ = localizer |
|
498 | 495 | |
|
499 | 496 | class _ObjectPermissionsForm(formencode.Schema): |
|
500 | 497 | allow_extra_fields = True |
|
501 | 498 | filter_extra_fields = True |
|
502 | 499 | overwrite_default_repo = v.StringBoolean(if_missing=False) |
|
503 | 500 | overwrite_default_group = v.StringBoolean(if_missing=False) |
|
504 | 501 | overwrite_default_user_group = v.StringBoolean(if_missing=False) |
|
505 | 502 | default_repo_perm = v.OneOf(repo_perms_choices) |
|
506 | 503 | default_group_perm = v.OneOf(group_perms_choices) |
|
507 | 504 | default_user_group_perm = v.OneOf(user_group_perms_choices) |
|
508 | 505 | return _ObjectPermissionsForm |
|
509 | 506 | |
|
510 | 507 | |
|
511 | 508 | def UserPermissionsForm(localizer, create_choices, create_on_write_choices, |
|
512 | 509 | repo_group_create_choices, user_group_create_choices, |
|
513 | 510 | fork_choices, inherit_default_permissions_choices): |
|
514 | 511 | _ = localizer |
|
515 | 512 | |
|
516 | 513 | class _DefaultPermissionsForm(formencode.Schema): |
|
517 | 514 | allow_extra_fields = True |
|
518 | 515 | filter_extra_fields = True |
|
519 | 516 | |
|
520 | 517 | anonymous = v.StringBoolean(if_missing=False) |
|
521 | 518 | |
|
522 | 519 | default_repo_create = v.OneOf(create_choices) |
|
523 | 520 | default_repo_create_on_write = v.OneOf(create_on_write_choices) |
|
524 | 521 | default_user_group_create = v.OneOf(user_group_create_choices) |
|
525 | 522 | default_repo_group_create = v.OneOf(repo_group_create_choices) |
|
526 | 523 | default_fork_create = v.OneOf(fork_choices) |
|
527 | 524 | default_inherit_default_permissions = v.OneOf(inherit_default_permissions_choices) |
|
528 | 525 | return _DefaultPermissionsForm |
|
529 | 526 | |
|
530 | 527 | |
|
531 | 528 | def UserIndividualPermissionsForm(localizer): |
|
532 | 529 | _ = localizer |
|
533 | 530 | |
|
534 | 531 | class _DefaultPermissionsForm(formencode.Schema): |
|
535 | 532 | allow_extra_fields = True |
|
536 | 533 | filter_extra_fields = True |
|
537 | 534 | |
|
538 | 535 | inherit_default_permissions = v.StringBoolean(if_missing=False) |
|
539 | 536 | return _DefaultPermissionsForm |
|
540 | 537 | |
|
541 | 538 | |
|
542 | 539 | def DefaultsForm(localizer, edit=False, old_data=None, supported_backends=BACKENDS.keys()): |
|
543 | 540 | _ = localizer |
|
544 | 541 | old_data = old_data or {} |
|
545 | 542 | |
|
546 | 543 | class _DefaultsForm(formencode.Schema): |
|
547 | 544 | allow_extra_fields = True |
|
548 | 545 | filter_extra_fields = True |
|
549 | 546 | default_repo_type = v.OneOf(supported_backends) |
|
550 | 547 | default_repo_private = v.StringBoolean(if_missing=False) |
|
551 | 548 | default_repo_enable_statistics = v.StringBoolean(if_missing=False) |
|
552 | 549 | default_repo_enable_downloads = v.StringBoolean(if_missing=False) |
|
553 | 550 | default_repo_enable_locking = v.StringBoolean(if_missing=False) |
|
554 | 551 | return _DefaultsForm |
|
555 | 552 | |
|
556 | 553 | |
|
557 | 554 | def AuthSettingsForm(localizer): |
|
558 | 555 | _ = localizer |
|
559 | 556 | |
|
560 | 557 | class _AuthSettingsForm(formencode.Schema): |
|
561 | 558 | allow_extra_fields = True |
|
562 | 559 | filter_extra_fields = True |
|
563 | 560 | auth_plugins = All(v.ValidAuthPlugins(localizer), |
|
564 | 561 | v.UniqueListFromString(localizer)(not_empty=True)) |
|
565 | 562 | return _AuthSettingsForm |
|
566 | 563 | |
|
567 | 564 | |
|
568 | 565 | def UserExtraEmailForm(localizer): |
|
569 | 566 | _ = localizer |
|
570 | 567 | |
|
571 | 568 | class _UserExtraEmailForm(formencode.Schema): |
|
572 | 569 | email = All(v.UniqSystemEmail(localizer), v.Email(not_empty=True)) |
|
573 | 570 | return _UserExtraEmailForm |
|
574 | 571 | |
|
575 | 572 | |
|
576 | 573 | def UserExtraIpForm(localizer): |
|
577 | 574 | _ = localizer |
|
578 | 575 | |
|
579 | 576 | class _UserExtraIpForm(formencode.Schema): |
|
580 | 577 | ip = v.ValidIp(localizer)(not_empty=True) |
|
581 | 578 | return _UserExtraIpForm |
|
582 | 579 | |
|
583 | 580 | |
|
584 | 581 | def PullRequestForm(localizer, repo_id): |
|
585 | 582 | _ = localizer |
|
586 | 583 | |
|
587 | 584 | class ReviewerForm(formencode.Schema): |
|
588 | 585 | user_id = v.Int(not_empty=True) |
|
589 | 586 | reasons = All() |
|
590 | 587 | mandatory = v.StringBoolean() |
|
591 | 588 | |
|
592 | 589 | class _PullRequestForm(formencode.Schema): |
|
593 | 590 | allow_extra_fields = True |
|
594 | 591 | filter_extra_fields = True |
|
595 | 592 | |
|
596 | 593 | common_ancestor = v.UnicodeString(strip=True, required=True) |
|
597 | 594 | source_repo = v.UnicodeString(strip=True, required=True) |
|
598 | 595 | source_ref = v.UnicodeString(strip=True, required=True) |
|
599 | 596 | target_repo = v.UnicodeString(strip=True, required=True) |
|
600 | 597 | target_ref = v.UnicodeString(strip=True, required=True) |
|
601 | 598 | revisions = All(#v.NotReviewedRevisions(localizer, repo_id)(), |
|
602 | 599 | v.UniqueList(localizer)(not_empty=True)) |
|
603 | 600 | review_members = formencode.ForEach(ReviewerForm()) |
|
604 | 601 | pullrequest_title = v.UnicodeString(strip=True, required=True) |
|
605 | 602 | pullrequest_desc = v.UnicodeString(strip=True, required=False) |
|
606 | 603 | |
|
607 | 604 | return _PullRequestForm |
|
608 | 605 | |
|
609 | 606 | |
|
610 | 607 | def IssueTrackerPatternsForm(localizer): |
|
611 | 608 | _ = localizer |
|
612 | 609 | |
|
613 | 610 | class _IssueTrackerPatternsForm(formencode.Schema): |
|
614 | 611 | allow_extra_fields = True |
|
615 | 612 | filter_extra_fields = False |
|
616 | 613 | chained_validators = [v.ValidPattern(localizer)] |
|
617 | 614 | return _IssueTrackerPatternsForm |
General Comments 0
You need to be logged in to leave comments.
Login now