##// END OF EJS Templates
feat(2fa): updated and UI fixes...
feat(2fa): updated and UI fixes - configure 2fa - setup 2fa - various small improvements

File last commit:

r5367:a11e6ff3 default
r5373:834643be default
Show More
forms.py
655 lines | 24.9 KiB | text/x-python | PythonLexer
copyrights: updated for 2023
r5088 # Copyright (C) 2010-2023 RhodeCode GmbH
project: added all source files and assets
r1 #
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# (only), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is dual-licensed. If you wish to learn more about the
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
"""
this is forms validation classes
http://formencode.org/module-formencode.validators.html
for list off all availible validators
we can create our own validators
The table below outlines the options which can be used in a schema in addition to the validators themselves
pre_validators [] These validators will be applied before the schema
chained_validators [] These validators will be applied after the schema
allow_extra_fields False If True, then it is not an error when keys that aren't associated with a validator are present
filter_extra_fields False If True, then keys that aren't associated with a validator are removed
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.
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
<name> = formencode.validators.<name of validator>
<name> must equal form name
list=[1,2,3,4,5]
for SELECT use formencode.All(OneOf(list), Int())
"""
dan
forms: add deform for integration settings forms
r518 import deform
dan
deform: use pypi deform library and add helpers to deform scope directly...
r519 import logging
import formencode
dan
forms: add deform for integration settings forms
r518 from pkg_resources import resource_filename
dan
deform: use pypi deform library and add helpers to deform scope directly...
r519 from formencode import All, Pipe
pyramid: if possible fetch csrf tokens from pyramid session....
r1918 from pyramid.threadlocal import get_current_request
dan
deform: use pypi deform library and add helpers to deform scope directly...
r519
from rhodecode import BACKENDS
from rhodecode.lib import helpers
from rhodecode.model import validators as v
log = logging.getLogger(__name__)
dan
forms: add deform for integration settings forms
r518
deform_templates = resource_filename('deform', 'templates')
rhodecode_templates = resource_filename('rhodecode', 'templates/forms')
search_path = (rhodecode_templates, deform_templates)
dan
deform: use pypi deform library and add helpers to deform scope directly...
r519
class RhodecodeFormZPTRendererFactory(deform.ZPTRendererFactory):
""" Subclass of ZPTRendererFactory to add rhodecode context variables """
def __call__(self, template_name, **kw):
kw['h'] = helpers
pyramid: if possible fetch csrf tokens from pyramid session....
r1918 kw['request'] = get_current_request()
dan
deform: use pypi deform library and add helpers to deform scope directly...
r519 return self.load(template_name)(**kw)
dan
forms: add deform for integration settings forms
r518
dan
deform: use pypi deform library and add helpers to deform scope directly...
r519 form_renderer = RhodecodeFormZPTRendererFactory(search_path)
deform.Form.set_default_renderer(form_renderer)
project: added all source files and assets
r1
pylons: remove pylons as dependency...
r2351 def LoginForm(localizer):
_ = localizer
project: added all source files and assets
r1 class _LoginForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
username = v.UnicodeString(
strip=True,
min=1,
not_empty=True,
messages={
modernize: python3 updates
r5096 'empty': _('Please enter a login'),
'tooShort': _('Enter a value %(min)i characters long or more')
project: added all source files and assets
r1 }
)
password = v.UnicodeString(
strip=False,
min=3,
security: limit the maximum password lenght to 72 characters to prevent possible...
r2192 max=72,
project: added all source files and assets
r1 not_empty=True,
messages={
modernize: python3 updates
r5096 'empty': _('Please enter a password'),
'tooShort': _('Enter %(min)i characters or more')}
project: added all source files and assets
r1 )
remember = v.StringBoolean(if_missing=False)
pylons: remove pylons as dependency...
r2351 chained_validators = [v.ValidAuth(localizer)]
project: added all source files and assets
r1 return _LoginForm
feat(2fa): Added 2fa option. Fixes: RCCE-65
r5360 def TOTPForm(localizer, user, allow_recovery_code_use=False):
_ = localizer
class _TOTPForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
totp = v.Regex(r'^(?:\d{6}|[A-Z0-9]{32})$')
feat(2fa): refactor logic arround validation/recoverycodes and workflows of configuration of 2fa...
r5367 secret_totp = v.String()
feat(2fa): Added 2fa option. Fixes: RCCE-65
r5360
def to_python(self, value, state=None):
validation_checks = [user.is_totp_valid]
if allow_recovery_code_use:
validation_checks.append(user.is_2fa_recovery_code_valid)
form_data = super().to_python(value, state)
received_code = form_data['totp']
feat(2fa): refactor logic arround validation/recoverycodes and workflows of configuration of 2fa...
r5367 secret = form_data.get('secret_totp')
if not any(map(lambda func: func(received_code, secret), validation_checks)):
feat(2fa): Added 2fa option. Fixes: RCCE-65
r5360 error_msg = _('Code is invalid. Try again!')
raise formencode.Invalid(error_msg, v, state, error_dict={'totp': error_msg})
feat(2fa): refactor logic arround validation/recoverycodes and workflows of configuration of 2fa...
r5367 return form_data
feat(2fa): Added 2fa option. Fixes: RCCE-65
r5360
return _TOTPForm
pylons: remove pylons as dependency...
r2351 def UserForm(localizer, edit=False, available_languages=None, old_data=None):
old_data = old_data or {}
available_languages = available_languages or []
_ = localizer
project: added all source files and assets
r1 class _UserForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
username = All(v.UnicodeString(strip=True, min=1, not_empty=True),
pylons: remove pylons as dependency...
r2351 v.ValidUsername(localizer, edit, old_data))
project: added all source files and assets
r1 if edit:
new_password = All(
pylons: remove pylons as dependency...
r2351 v.ValidPassword(localizer),
security: limit the maximum password lenght to 72 characters to prevent possible...
r2192 v.UnicodeString(strip=False, min=6, max=72, not_empty=False)
project: added all source files and assets
r1 )
password_confirmation = All(
pylons: remove pylons as dependency...
r2351 v.ValidPassword(localizer),
security: limit the maximum password lenght to 72 characters to prevent possible...
r2192 v.UnicodeString(strip=False, min=6, max=72, not_empty=False),
project: added all source files and assets
r1 )
admin = v.StringBoolean(if_missing=False)
else:
password = All(
pylons: remove pylons as dependency...
r2351 v.ValidPassword(localizer),
security: limit the maximum password lenght to 72 characters to prevent possible...
r2192 v.UnicodeString(strip=False, min=6, max=72, not_empty=True)
project: added all source files and assets
r1 )
password_confirmation = All(
pylons: remove pylons as dependency...
r2351 v.ValidPassword(localizer),
security: limit the maximum password lenght to 72 characters to prevent possible...
r2192 v.UnicodeString(strip=False, min=6, max=72, not_empty=False)
project: added all source files and assets
r1 )
password_change = v.StringBoolean(if_missing=False)
create_repo_group = v.StringBoolean(if_missing=False)
active = v.StringBoolean(if_missing=False)
firstname = v.UnicodeString(strip=True, min=1, not_empty=False)
lastname = v.UnicodeString(strip=True, min=1, not_empty=False)
release: merge back stable branch into default
r2391 email = All(v.UniqSystemEmail(localizer, old_data), v.Email(not_empty=True))
users: do not require description on admin user creation
r4056 description = v.UnicodeString(strip=True, min=1, max=250, not_empty=False,
if_missing='')
project: added all source files and assets
r1 extern_name = v.UnicodeString(strip=True)
extern_type = v.UnicodeString(strip=True)
language = v.OneOf(available_languages, hideList=False,
testValueList=True, if_missing=None)
pylons: remove pylons as dependency...
r2351 chained_validators = [v.ValidPasswordsMatch(localizer)]
project: added all source files and assets
r1 return _UserForm
pylons: remove pylons as dependency...
r2351 def UserGroupForm(localizer, edit=False, old_data=None, allow_disabled=False):
repos, repo groups, user groups: allow to use disabled users in owner field....
r224 old_data = old_data or {}
pylons: remove pylons as dependency...
r2351 _ = localizer
repos, repo groups, user groups: allow to use disabled users in owner field....
r224
project: added all source files and assets
r1 class _UserGroupForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
users_group_name = All(
v.UnicodeString(strip=True, min=1, not_empty=True),
pylons: remove pylons as dependency...
r2351 v.ValidUserGroup(localizer, edit, old_data)
project: added all source files and assets
r1 )
user_group_description = v.UnicodeString(strip=True, min=1,
not_empty=False)
users_group_active = v.StringBoolean(if_missing=False)
if edit:
repos, repo groups, user groups: allow to use disabled users in owner field....
r224 # this is user group owner
user = All(
v.UnicodeString(not_empty=True),
pylons: remove pylons as dependency...
r2351 v.ValidRepoUser(localizer, allow_disabled))
project: added all source files and assets
r1 return _UserGroupForm
pylons: remove pylons as dependency...
r2351 def RepoGroupForm(localizer, edit=False, old_data=None, available_groups=None,
can_create_in_root=False, allow_disabled=False):
_ = localizer
repos, repo groups, user groups: allow to use disabled users in owner field....
r224 old_data = old_data or {}
available_groups = available_groups or []
project: added all source files and assets
r1 class _RepoGroupForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
group_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
pylons: remove pylons as dependency...
r2351 v.SlugifyName(localizer),)
project: added all source files and assets
r1 group_description = v.UnicodeString(strip=True, min=1,
not_empty=False)
group_copy_permissions = v.StringBoolean(if_missing=False)
group_parent_id = v.OneOf(available_groups, hideList=False,
testValueList=True, not_empty=True)
enable_locking = v.StringBoolean(if_missing=False)
repos, repo groups, user groups: allow to use disabled users in owner field....
r224 chained_validators = [
pylons: remove pylons as dependency...
r2351 v.ValidRepoGroup(localizer, edit, old_data, can_create_in_root)]
project: added all source files and assets
r1
if edit:
repos, repo groups, user groups: allow to use disabled users in owner field....
r224 # this is repo group owner
user = All(
v.UnicodeString(not_empty=True),
pylons: remove pylons as dependency...
r2351 v.ValidRepoUser(localizer, allow_disabled))
project: added all source files and assets
r1 return _RepoGroupForm
pylons: remove pylons as dependency...
r2351 def RegisterForm(localizer, edit=False, old_data=None):
_ = localizer
old_data = old_data or {}
project: added all source files and assets
r1 class _RegisterForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
username = All(
pylons: remove pylons as dependency...
r2351 v.ValidUsername(localizer, edit, old_data),
project: added all source files and assets
r1 v.UnicodeString(strip=True, min=1, not_empty=True)
)
password = All(
pylons: remove pylons as dependency...
r2351 v.ValidPassword(localizer),
security: limit the maximum password lenght to 72 characters to prevent possible...
r2192 v.UnicodeString(strip=False, min=6, max=72, not_empty=True)
project: added all source files and assets
r1 )
password_confirmation = All(
pylons: remove pylons as dependency...
r2351 v.ValidPassword(localizer),
security: limit the maximum password lenght to 72 characters to prevent possible...
r2192 v.UnicodeString(strip=False, min=6, max=72, not_empty=True)
project: added all source files and assets
r1 )
active = v.StringBoolean(if_missing=False)
firstname = v.UnicodeString(strip=True, min=1, not_empty=False)
lastname = v.UnicodeString(strip=True, min=1, not_empty=False)
release: merge back stable branch into default
r2391 email = All(v.UniqSystemEmail(localizer, old_data), v.Email(not_empty=True))
project: added all source files and assets
r1
pylons: remove pylons as dependency...
r2351 chained_validators = [v.ValidPasswordsMatch(localizer)]
project: added all source files and assets
r1 return _RegisterForm
pylons: remove pylons as dependency...
r2351 def PasswordResetForm(localizer):
_ = localizer
project: added all source files and assets
r1 class _PasswordResetForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
pylons: remove pylons as dependency...
r2351 email = All(v.ValidSystemEmail(localizer), v.Email(not_empty=True))
project: added all source files and assets
r1 return _PasswordResetForm
landing-rev: fixes #4102, use branches instead of landing tip refs by default....
r3881 def RepoForm(localizer, edit=False, old_data=None, repo_groups=None, allow_disabled=False):
pylons: remove pylons as dependency...
r2351 _ = localizer
project: added all source files and assets
r1 old_data = old_data or {}
repo_groups = repo_groups or []
supported_backends = BACKENDS.keys()
class _RepoForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
pylons: remove pylons as dependency...
r2351 v.SlugifyName(localizer), v.CannotHaveGitSuffix(localizer))
repo_group = All(v.CanWriteGroup(localizer, old_data),
project: added all source files and assets
r1 v.OneOf(repo_groups, hideList=True))
repo_type = v.OneOf(supported_backends, required=False,
if_missing=old_data.get('repo_type'))
repo_description = v.UnicodeString(strip=True, min=1, not_empty=False)
repo_private = v.StringBoolean(if_missing=False)
repo_copy_permissions = v.StringBoolean(if_missing=False)
clone_uri = All(v.UnicodeString(strip=True, min=1, not_empty=False))
repo_enable_statistics = v.StringBoolean(if_missing=False)
repo_enable_downloads = v.StringBoolean(if_missing=False)
repo_enable_locking = v.StringBoolean(if_missing=False)
if edit:
# this is repo owner
repos, repo groups, user groups: allow to use disabled users in owner field....
r224 user = All(
v.UnicodeString(not_empty=True),
pylons: remove pylons as dependency...
r2351 v.ValidRepoUser(localizer, allow_disabled))
project: added all source files and assets
r1 clone_uri_change = v.UnicodeString(
not_empty=False, if_missing=v.Missing)
pylons: remove pylons as dependency...
r2351 chained_validators = [v.ValidCloneUri(localizer),
v.ValidRepoName(localizer, edit, old_data)]
project: added all source files and assets
r1 return _RepoForm
pylons: remove pylons as dependency...
r2351 def RepoPermsForm(localizer):
_ = localizer
project: added all source files and assets
r1 class _RepoPermsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
pylons: remove pylons as dependency...
r2351 chained_validators = [v.ValidPerms(localizer, type_='repo')]
project: added all source files and assets
r1 return _RepoPermsForm
pylons: remove pylons as dependency...
r2351 def RepoGroupPermsForm(localizer, valid_recursive_choices):
_ = localizer
project: added all source files and assets
r1 class _RepoGroupPermsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
recursive = v.OneOf(valid_recursive_choices)
pylons: remove pylons as dependency...
r2351 chained_validators = [v.ValidPerms(localizer, type_='repo_group')]
project: added all source files and assets
r1 return _RepoGroupPermsForm
pylons: remove pylons as dependency...
r2351 def UserGroupPermsForm(localizer):
_ = localizer
project: added all source files and assets
r1 class _UserPermsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
pylons: remove pylons as dependency...
r2351 chained_validators = [v.ValidPerms(localizer, type_='user_group')]
project: added all source files and assets
r1 return _UserPermsForm
pylons: remove pylons as dependency...
r2351 def RepoFieldForm(localizer):
_ = localizer
project: added all source files and assets
r1 class _RepoFieldForm(formencode.Schema):
filter_extra_fields = True
allow_extra_fields = True
pylons: remove pylons as dependency...
r2351 new_field_key = All(v.FieldKey(localizer),
project: added all source files and assets
r1 v.UnicodeString(strip=True, min=3, not_empty=True))
modernize: python3 updates
r5096 new_field_value = v.UnicodeString(not_empty=False, if_missing='')
project: added all source files and assets
r1 new_field_type = v.OneOf(['str', 'unicode', 'list', 'tuple'],
if_missing='str')
new_field_label = v.UnicodeString(not_empty=False)
new_field_desc = v.UnicodeString(not_empty=False)
return _RepoFieldForm
pylons: remove pylons as dependency...
r2351 def RepoForkForm(localizer, edit=False, old_data=None,
landing-rev: fixes #4102, use branches instead of landing tip refs by default....
r3881 supported_backends=BACKENDS.keys(), repo_groups=None):
pylons: remove pylons as dependency...
r2351 _ = localizer
old_data = old_data or {}
repo_groups = repo_groups or []
project: added all source files and assets
r1 class _RepoForkForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
pylons: remove pylons as dependency...
r2351 v.SlugifyName(localizer))
repo_group = All(v.CanWriteGroup(localizer, ),
project: added all source files and assets
r1 v.OneOf(repo_groups, hideList=True))
pylons: remove pylons as dependency...
r2351 repo_type = All(v.ValidForkType(localizer, old_data), v.OneOf(supported_backends))
project: added all source files and assets
r1 description = v.UnicodeString(strip=True, min=1, not_empty=True)
private = v.StringBoolean(if_missing=False)
copy_permissions = v.StringBoolean(if_missing=False)
fork_parent_id = v.UnicodeString()
pylons: remove pylons as dependency...
r2351 chained_validators = [v.ValidForkName(localizer, edit, old_data)]
project: added all source files and assets
r1 return _RepoForkForm
pylons: remove pylons as dependency...
r2351 def ApplicationSettingsForm(localizer):
_ = localizer
project: added all source files and assets
r1 class _ApplicationSettingsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
rhodecode_title = v.UnicodeString(strip=True, max=40, not_empty=False)
rhodecode_realm = v.UnicodeString(strip=True, min=1, not_empty=True)
rhodecode_pre_code = v.UnicodeString(strip=True, min=1, not_empty=False)
rhodecode_post_code = v.UnicodeString(strip=True, min=1, not_empty=False)
rhodecode_captcha_public_key = v.UnicodeString(strip=True, min=1, not_empty=False)
rhodecode_captcha_private_key = v.UnicodeString(strip=True, min=1, not_empty=False)
repo-groups: implemented default personal repo groups logic....
r1094 rhodecode_create_personal_repo_group = v.StringBoolean(if_missing=False)
rhodecode_personal_repo_group_pattern = v.UnicodeString(strip=True, min=1, not_empty=False)
project: added all source files and assets
r1 return _ApplicationSettingsForm
pylons: remove pylons as dependency...
r2351 def ApplicationVisualisationForm(localizer):
visual-settings: fill in default clone/ssh clone urls if they aren't provided....
r2616 from rhodecode.model.db import Repository
pylons: remove pylons as dependency...
r2351 _ = localizer
project: added all source files and assets
r1 class _ApplicationVisualisationForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
rhodecode_show_public_icon = v.StringBoolean(if_missing=False)
rhodecode_show_private_icon = v.StringBoolean(if_missing=False)
rhodecode_stylify_metatags = v.StringBoolean(if_missing=False)
rhodecode_repository_fields = v.StringBoolean(if_missing=False)
rhodecode_lightweight_journal = v.StringBoolean(if_missing=False)
rhodecode_dashboard_items = v.Int(min=5, not_empty=True)
rhodecode_admin_grid_items = v.Int(min=5, not_empty=True)
rhodecode_show_version = v.StringBoolean(if_missing=False)
rhodecode_use_gravatar = v.StringBoolean(if_missing=False)
rhodecode_markup_renderer = v.OneOf(['markdown', 'rst'])
rhodecode_gravatar_url = v.UnicodeString(min=3)
visual-settings: fill in default clone/ssh clone urls if they aren't provided....
r2616 rhodecode_clone_uri_tmpl = v.UnicodeString(not_empty=False, if_empty=Repository.DEFAULT_CLONE_URI)
clone-urls: allow custom clone by id template.
r4629 rhodecode_clone_uri_id_tmpl = v.UnicodeString(not_empty=False, if_empty=Repository.DEFAULT_CLONE_URI_ID)
visual-settings: fill in default clone/ssh clone urls if they aren't provided....
r2616 rhodecode_clone_uri_ssh_tmpl = v.UnicodeString(not_empty=False, if_empty=Repository.DEFAULT_CLONE_URI_SSH)
project: added all source files and assets
r1 rhodecode_support_url = v.UnicodeString()
rhodecode_show_revision_number = v.StringBoolean(if_missing=False)
rhodecode_show_sha_length = v.Int(min=4, not_empty=True)
return _ApplicationVisualisationForm
class _BaseVcsSettingsForm(formencode.Schema):
pylons: remove pylons as dependency...
r2351
project: added all source files and assets
r1 allow_extra_fields = True
filter_extra_fields = False
hooks_changegroup_repo_size = v.StringBoolean(if_missing=False)
hooks_changegroup_push_logger = v.StringBoolean(if_missing=False)
hooks_outgoing_pull_logger = v.StringBoolean(if_missing=False)
git-lfs: settings for GIT repos to enable git-lfs and set store location...
r1570 # PR/Code-review
rhodecode_pr_merge_enabled = v.StringBoolean(if_missing=False)
rhodecode_use_outdated_comments = v.StringBoolean(if_missing=False)
# hg
project: added all source files and assets
r1 extensions_largefiles = v.StringBoolean(if_missing=False)
mercurial-evolve: enable evolve setting on repositories.
r1738 extensions_evolve = v.StringBoolean(if_missing=False)
project: added all source files and assets
r1 phases_publish = v.StringBoolean(if_missing=False)
Mathieu Cantin
mercurial: Add option to close a branch before merging
r2055
Martin Bornhold
settings: Add the 'rebase-merge' setting to VCS base form and VCS settings model.
r358 rhodecode_hg_use_rebase_for_merging = v.StringBoolean(if_missing=False)
Mathieu Cantin
mercurial: Add option to close a branch before merging
r2055 rhodecode_hg_close_branch_before_merging = v.StringBoolean(if_missing=False)
project: added all source files and assets
r1
git-lfs: settings for GIT repos to enable git-lfs and set store location...
r1570 # git
vcs_git_lfs_enabled = v.StringBoolean(if_missing=False)
pull-requests: use close action with proper --close-commit solution....
r2056 rhodecode_git_use_rebase_for_merging = v.StringBoolean(if_missing=False)
rhodecode_git_close_branch_before_merging = v.StringBoolean(if_missing=False)
git-lfs: settings for GIT repos to enable git-lfs and set store location...
r1570
Bartłomiej Wołyńczyk
caching: add option to cache diffs for commits and pull requests....
r2685 # cache
rhodecode_diff_cache = v.StringBoolean(if_missing=False)
project: added all source files and assets
r1
pylons: remove pylons as dependency...
r2351 def ApplicationUiSettingsForm(localizer):
_ = localizer
project: added all source files and assets
r1 class _ApplicationUiSettingsForm(_BaseVcsSettingsForm):
web_push_ssl = v.StringBoolean(if_missing=False)
mercurial: allow editing largefile store from web interface.
r1563 largefiles_usercache = All(
pylons: remove pylons as dependency...
r2351 v.ValidPath(localizer),
git-lfs: settings for GIT repos to enable git-lfs and set store location...
r1570 v.UnicodeString(strip=True, min=2, not_empty=True))
vcs_git_lfs_store_location = All(
pylons: remove pylons as dependency...
r2351 v.ValidPath(localizer),
git-lfs: settings for GIT repos to enable git-lfs and set store location...
r1570 v.UnicodeString(strip=True, min=2, not_empty=True))
project: added all source files and assets
r1 extensions_hggit = v.StringBoolean(if_missing=False)
pylons: remove pylons as dependency...
r2351 new_svn_branch = v.ValidSvnPattern(localizer, section='vcs_svn_branch')
new_svn_tag = v.ValidSvnPattern(localizer, section='vcs_svn_tag')
project: added all source files and assets
r1 return _ApplicationUiSettingsForm
pylons: remove pylons as dependency...
r2351 def RepoVcsSettingsForm(localizer, repo_name):
_ = localizer
project: added all source files and assets
r1 class _RepoVcsSettingsForm(_BaseVcsSettingsForm):
inherit_global_settings = v.StringBoolean(if_missing=False)
pylons: remove pylons as dependency...
r2351 new_svn_branch = v.ValidSvnPattern(localizer,
project: added all source files and assets
r1 section='vcs_svn_branch', repo_name=repo_name)
pylons: remove pylons as dependency...
r2351 new_svn_tag = v.ValidSvnPattern(localizer,
project: added all source files and assets
r1 section='vcs_svn_tag', repo_name=repo_name)
return _RepoVcsSettingsForm
pylons: remove pylons as dependency...
r2351 def LabsSettingsForm(localizer):
_ = localizer
project: added all source files and assets
r1 class _LabSettingsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
return _LabSettingsForm
settings: fix #3944 add password reset permission
r1034 def ApplicationPermissionsForm(
pylons: remove pylons as dependency...
r2351 localizer, register_choices, password_reset_choices,
extern_activate_choices):
_ = localizer
project: added all source files and assets
r1 class _DefaultPermissionsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
anonymous = v.StringBoolean(if_missing=False)
default_register = v.OneOf(register_choices)
default_register_message = v.UnicodeString()
settings: fix #3944 add password reset permission
r1034 default_password_reset = v.OneOf(password_reset_choices)
project: added all source files and assets
r1 default_extern_activate = v.OneOf(extern_activate_choices)
return _DefaultPermissionsForm
pylons: remove pylons as dependency...
r2351 def ObjectPermissionsForm(localizer, repo_perms_choices, group_perms_choices,
project: added all source files and assets
r1 user_group_perms_choices):
pylons: remove pylons as dependency...
r2351 _ = localizer
project: added all source files and assets
r1 class _ObjectPermissionsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
overwrite_default_repo = v.StringBoolean(if_missing=False)
overwrite_default_group = v.StringBoolean(if_missing=False)
overwrite_default_user_group = v.StringBoolean(if_missing=False)
branch permissions: added logic to define in UI branch permissions....
r2975
project: added all source files and assets
r1 default_repo_perm = v.OneOf(repo_perms_choices)
default_group_perm = v.OneOf(group_perms_choices)
default_user_group_perm = v.OneOf(user_group_perms_choices)
branch permissions: added logic to define in UI branch permissions....
r2975
project: added all source files and assets
r1 return _ObjectPermissionsForm
branch permissions: added logic to define in UI branch permissions....
r2975 def BranchPermissionsForm(localizer, branch_perms_choices):
_ = localizer
class _BranchPermissionsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
overwrite_default_branch = v.StringBoolean(if_missing=False)
default_branch_perm = v.OneOf(branch_perms_choices)
return _BranchPermissionsForm
pylons: remove pylons as dependency...
r2351 def UserPermissionsForm(localizer, create_choices, create_on_write_choices,
project: added all source files and assets
r1 repo_group_create_choices, user_group_create_choices,
fork_choices, inherit_default_permissions_choices):
pylons: remove pylons as dependency...
r2351 _ = localizer
project: added all source files and assets
r1 class _DefaultPermissionsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
anonymous = v.StringBoolean(if_missing=False)
default_repo_create = v.OneOf(create_choices)
default_repo_create_on_write = v.OneOf(create_on_write_choices)
default_user_group_create = v.OneOf(user_group_create_choices)
default_repo_group_create = v.OneOf(repo_group_create_choices)
default_fork_create = v.OneOf(fork_choices)
default_inherit_default_permissions = v.OneOf(inherit_default_permissions_choices)
return _DefaultPermissionsForm
pylons: remove pylons as dependency...
r2351 def UserIndividualPermissionsForm(localizer):
_ = localizer
project: added all source files and assets
r1 class _DefaultPermissionsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
inherit_default_permissions = v.StringBoolean(if_missing=False)
return _DefaultPermissionsForm
pylons: remove pylons as dependency...
r2351 def DefaultsForm(localizer, edit=False, old_data=None, supported_backends=BACKENDS.keys()):
_ = localizer
old_data = old_data or {}
project: added all source files and assets
r1 class _DefaultsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
default_repo_type = v.OneOf(supported_backends)
default_repo_private = v.StringBoolean(if_missing=False)
default_repo_enable_statistics = v.StringBoolean(if_missing=False)
default_repo_enable_downloads = v.StringBoolean(if_missing=False)
default_repo_enable_locking = v.StringBoolean(if_missing=False)
return _DefaultsForm
pylons: remove pylons as dependency...
r2351 def AuthSettingsForm(localizer):
_ = localizer
project: added all source files and assets
r1 class _AuthSettingsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
pylons: remove pylons as dependency...
r2351 auth_plugins = All(v.ValidAuthPlugins(localizer),
v.UniqueListFromString(localizer)(not_empty=True))
project: added all source files and assets
r1 return _AuthSettingsForm
pylons: remove pylons as dependency...
r2351 def UserExtraEmailForm(localizer):
_ = localizer
project: added all source files and assets
r1 class _UserExtraEmailForm(formencode.Schema):
pylons: remove pylons as dependency...
r2351 email = All(v.UniqSystemEmail(localizer), v.Email(not_empty=True))
project: added all source files and assets
r1 return _UserExtraEmailForm
pylons: remove pylons as dependency...
r2351 def UserExtraIpForm(localizer):
_ = localizer
project: added all source files and assets
r1 class _UserExtraIpForm(formencode.Schema):
pylons: remove pylons as dependency...
r2351 ip = v.ValidIp(localizer)(not_empty=True)
project: added all source files and assets
r1 return _UserExtraIpForm
pylons: remove pylons as dependency...
r2351 def PullRequestForm(localizer, repo_id):
_ = localizer
dan
reviewers: store reviewer reasons to database, fixes #4238
r873
class ReviewerForm(formencode.Schema):
user_id = v.Int(not_empty=True)
reasons = All()
default-reviewers: introduce new voting rule logic that allows...
r2484 rules = All(v.UniqueList(localizer, convert=int)())
pull-request: extended default reviewers functionality....
r1769 mandatory = v.StringBoolean()
reviewers: added observers as another way to define reviewers....
r4500 role = v.String(if_missing='reviewer')
class ObserverForm(formencode.Schema):
user_id = v.Int(not_empty=True)
reasons = All()
rules = All(v.UniqueList(localizer, convert=int)())
mandatory = v.StringBoolean()
role = v.String(if_missing='observer')
dan
reviewers: store reviewer reasons to database, fixes #4238
r873
project: added all source files and assets
r1 class _PullRequestForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
pull-request: extended default reviewers functionality....
r1769 common_ancestor = v.UnicodeString(strip=True, required=True)
project: added all source files and assets
r1 source_repo = v.UnicodeString(strip=True, required=True)
source_ref = v.UnicodeString(strip=True, required=True)
target_repo = v.UnicodeString(strip=True, required=True)
target_ref = v.UnicodeString(strip=True, required=True)
pylons: remove pylons as dependency...
r2351 revisions = All(#v.NotReviewedRevisions(localizer, repo_id)(),
v.UniqueList(localizer)(not_empty=True))
dan
reviewers: store reviewer reasons to database, fixes #4238
r873 review_members = formencode.ForEach(ReviewerForm())
reviewers: added observers as another way to define reviewers....
r4500 observer_members = formencode.ForEach(ObserverForm())
pull-requests: drop required minimal 3 characters for title
r3647 pullrequest_title = v.UnicodeString(strip=True, required=True, min=1, max=255)
project: added all source files and assets
r1 pullrequest_desc = v.UnicodeString(strip=True, required=False)
pull-requests: make the renderer stored and saved for each pull requests....
r2903 description_renderer = v.UnicodeString(strip=True, required=False)
project: added all source files and assets
r1
return _PullRequestForm
pylons: remove pylons as dependency...
r2351 def IssueTrackerPatternsForm(localizer):
_ = localizer
project: added all source files and assets
r1 class _IssueTrackerPatternsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
pylons: remove pylons as dependency...
r2351 chained_validators = [v.ValidPattern(localizer)]
project: added all source files and assets
r1 return _IssueTrackerPatternsForm