|
|
Mads Kiilerich
|
e3d033042fca
|
5 years ago
|
|
|
|
|
Mads Kiilerich
|
116151b6bfb2
|
5 years ago
|
|
celery: drop tracking of task_id - we use ignore_result=True and will never get anything back
There is thus no need for configuration of celery.result_backend .
The alternative would be to fix it. That could give better error reporting from failing repo creations, but would require quite a bit of additional changes before it actually works reliably.
|
|
|
Mads Kiilerich
|
4f0de9468da3
|
5 years ago
|
|
controllers: move controllers base class from lib/base to controllers
TG quickstart put it in lib/base.py , but it fits better on the controllers layer as a base there.
The contributing docs were a bit ahead of time ... but with a typo.
|
|
|
Mads Kiilerich
|
f78ccff15f43
|
5 years ago
|
|
celery: use kallithea.CELERY_APP.AsyncResult instead of celery.result import
This is more spot-on and more correct.
|
|
|
Mads Kiilerich
|
7b7afdbe57af
|
5 years ago
|
|
|
|
|
Mads Kiilerich
|
2a2a50e10026
|
5 years ago
|
|
repo_groups: fix select of parent group when adding repo group
h.select was passed a list of repo groups where group_id was integer, but parent_group in the request was a string - thus no match.
Do as in repos controller create_repository (and in error handling): leave it to htmlfill to patch up the generated HTML using defaults ... but make sure we always have a default.
|
|
|
Mads Kiilerich
|
259213d96dca
|
5 years ago
|
|
|
|
|
Mads Kiilerich
|
67e5b90801aa
|
5 years ago
|
|
lib: move webhelpers2 and friends to webutils
Gives less of the unfortunate use of helpers - especially in low level libs.
|
|
|
Mads Kiilerich
|
f8b092f9e6a3
|
5 years ago
|
|
lib: consistently use webutils.url instead of h.url
Templates are still the valid use case for accessing through h.
Simplify mocking of url() function.
|
|
|
Mads Kiilerich
|
7c30a3db0cdf
|
5 years ago
|
|
lib: drop sparsely used h.not_mapped_error
It might be a good idea, but then we should use it much more consistently ... and it should probably be done differently. Let's keep it simple and be consistent.
|
|
|
Mads Kiilerich
|
5e46f73f0d1c
|
5 years ago
|
|
|
|
|
Mads Kiilerich
|
b095e2fbba44
|
5 years ago
|
|
|
|
|
Mads Kiilerich
|
0be48652ca48
|
5 years ago
|
|
routing: separate url handling from routing - move it to webutils
This is a helper method relying on the thread local tg.request. We didn't have a good place to put it. Now we do.
This (re)moves unfortunate dependencies to the routing module (which almost is a controller).
|
|
|
Mads Kiilerich
|
3ccb302bb551
|
5 years ago
|
|
|
|
|
Mads Kiilerich
|
2ce710e81e61
|
6 years ago
|
|
permissions: drop hg.create.write_on_repogroup "Repository creation with group write access" setting
Simplify permissions system and get rid of some confusing tech debt.
Before, the global 'write_on_repogroup' setting controlled what write permission on a repo group meant.
With this change, users can create repositories in a repo group if and only if they have write access. Write access to a repo group will now mean the permission to create repositories in it.
Write access to repo groups must be granted explicitly. There should not be any other reason to grant write access than to allow users to create repos. There is thus no upgrade concerns for this change.
An admin that doesn't want users to create repos in a repogroup should just not give them write access.
These global settings might still exist in the database, but is ignored and no longer used and do no harm.
|
|
|
Mads Kiilerich
|
c19e720cbb21
|
6 years ago
|
|
|
|
|
Mads Kiilerich
|
0456028c4ffe
|
6 years ago
|
|
|
|
|
Mads Kiilerich
|
aec1b9c9ffe6
|
6 years ago
|
|
db: drop Repository CacheInvalidation
The benefit of this functionality is questionable. Especially in bigger setups with multiple front-end instances all serving the same multitude of repositories, making the hit rate very low. And the overhead of storing cache invalidation data *in* the database is non-trivial.
We preserve a small cache in Repository SA records, but should probably just in general know what we are doing and not ask for the same information multiple times in each request.
|
|
|
Mads Kiilerich
|
2fa9f497faac
|
6 years ago
|
|
repos: separate repo creation from form validation
The broad catching of Exception in the repo creation controller is conceptually bad. It also caused misleading "Error creating repository None" when form validation failed with anything but formencode.Invalid . For now, just constrain the broad exception handling to only cover repo creation. It is a bug if form validation fails in unexpected ways, and we want it reported as a crash that we can fix.
|
|
|
Mads Kiilerich
|
046fbed12f70
|
6 years ago
|
|
celery: use celery directly instead of leaky abstraction in celerypylons
Things start making more sense when we remove unnecessary complexity ...
|
|
|
Mads Kiilerich
|
3b1b440b5082
|
6 years ago
|
|
celery: use the proper configured global app for scheduling and retrieving tasks 193138922d56 broke celery, due to magic dependencies on initialization and setting global configuration at import time. Instead, always use the correctly configured global Celery app, both when creating tasks and checking result status. This has been tested to work on Python 3.6 - for example for sending mails and forking repos. Celery has however been found to not work on Python 3.7, due to Celery 3.x using the new reserved keyword 'async'.
|
|
|
Mads Kiilerich
|
894a662b12b3
|
6 years ago
|
|
celery: refactor initialization - replace global CELERY_ON flag with CELERY_APP with the actual celery app that it indicates Prepare for fixing how 193138922d56 broke celery due to magic dependencies on initialization of global state at import time.
|
|
|
Mads Kiilerich
|
4f03bd5ac2f2
|
6 years ago
|
|
lib: handle both HTML, unsafe strings, and exceptions passed to helpers.flash()
Before, h.flash would trust any input to contain html ... and callers would convert exceptions to string, often with a simple str() or unicode() ... which really didn't deserve to be trusted.
Instead, only trust messages that have a __html__ and escape anything else ... but also apply str/unicode on the parameter so the caller doesn't have to but *can* pass an exception directly.
|
|
|
Mads Kiilerich
|
d3d689ef4306
|
6 years ago
|
|
|
|
|
Mads Kiilerich
|
fe4086096758
|
6 years ago
|
|
|
|
|
Mads Kiilerich
|
0a277465fddf
|
6 years ago
|
|
|
|
|
Mads Kiilerich
|
e7ba4c0ec050
|
6 years ago
|
|
|
|
|
Mads Kiilerich
|
509b0dca0a3a
|
6 years ago
|
|
|
|
|
Mads Kiilerich
|
1a25c408d8a4
|
6 years ago
|
|
|
|
|
Mads Kiilerich
|
16df4993b442
|
7 years ago
|
|
scm: don't try to get IP address from web request in model
Remove a layering violation and make functions more reusable when they no longer depend on global state.
At this level, the IP address (and information about the current user) is only used for hooks logging push / pull operations. Arguably, IP address logging only belongs in an HTTP access log, not in the log of push/pull operations. But as long as we have IP addresses in the logs, we have to provide it. The (good?) alternative would be to drop IP address from the push / pull logs ...
|
|
|
Mads Kiilerich
|
99edd97366e3
|
7 years ago
|
|
locking: drop the pull-to-lock / push-to-unlock functionality
The feature is not worth the maintenance cost. The locking is too coarse and unflexible with insufficient UI and UX. The implementation is also quite invasive in tricky areas of the code, and thus high maintenance. Dropping this will enable other cleanup ... or at least make it easier.
|
|
|
Thomas De Schampheleire
|
7aff9a999536
|
7 years ago
|
|
templates, controllers: replace webhelpers.html.literal() with webhelpers.html.HTML() where possible Usage of webhelpers.literal (h.literal) can be a problem when variables are not correctly escaped. Luckily, this function can be avoided in several cases. Several users of the construct: h.literal(_('..A..') % (..B..)) can be simplified if (..B..) just contains a call to h.link_to. In this case, there is actually no need to use h.literal, because the object returned by link_to is already a literal. It is sufficient to use webhelpers.html.HTML() like so: h.HTML(_('..A..')) % (..B..) which is better because it will escape the '..A..' part instead of passing it literally. The need to wrap the '..A..' part in HTML() is to make sure the (escaped) end result is not a plain string but a 'literal' to avoid double escaping later. See also the documentation: https://docs.pylonsproject.org/projects/webhelpers/en/latest/modules/html/builder.html" When literal is used in a mixed expression containing both literals and ordinary strings, it tries hard to escape the strings and return a literal. However, this depends on which value has “control” of the expression. literal seems to be able to take control with all combinations of the + operator, but with % and join it must be on the left side of the expression. So these all work: "A" + literal("B") literal(", ").join(["A", literal("B")]) literal("%s %s") % (16, literal("kg")) But these return an ordinary string which is prone to double-escaping later: "\n".join([literal('<span class="foo">Foo!</span>'), literal('Bar!')]) "%s %s" % (literal("16"), literal("<em>kg</em>")) " This same escaping with 'HTML()' was already done by default in mako templates for constructs like ${_("something")} that do not contain format specifiers. When the translated string _does_ contain format specifiers, we want to use the same escaping, but we have to do it explicit and earlier so the escaping happens already when strings are inserted into the template string.
|
|
|
Mads Kiilerich
|
a6927fb86fa9
|
7 years ago
|
|
|
|
|
Mads Kiilerich
|
4707d09d49a6
|
7 years ago
|
|
repos: make edit_permissions_revoke controller return an actual (empty) body on success
The code 204 was slightly confusing even though technically OK.
|
|
|
Mads Kiilerich
|
b3289fef0daa
|
7 years ago
|
|
|
|
|
Mads Kiilerich
|
c0c8d12dc032
|
8 years ago
|
|
repos: add missing access control check for repository permission management This issue was found and reported by Kacper Szurek https://security.szurek.pl/
|
|
|
Mads Kiilerich
|
959e009afcae
|
8 years ago
|
|
repos: add missing access control check for repository permission management This issue was found and reported by Kacper Szurek https://security.szurek.pl/
|
|
|
Mads Kiilerich
|
af938280e76a
|
8 years ago
|
|
|
|
|
Mads Kiilerich
|
1b737e25266c
|
8 years ago
|
|
|
|
|
Mads Kiilerich
|
a86ebf58c720
|
8 years ago
|
|
templates: drop unused get_repos_as_dict super_user parameter
It was perhaps at some point used to show a content menu.
|
|
|
Mads Kiilerich
|
aa25ef34ebab
|
8 years ago
|
|
auth: refactor to introduce @LoginRequired(allow_default_user=True) and deprecate @NotAnonymous() It was error prone that @LoginRequired defaulted to allow anonymous users (if 'default' user is enabled). See also 245b4e3abf39. Refactor code to make it more explicit and safe by default: Deprecate @NotAnonymous by making it the default of @LoginRequired. That will make it safe by default. To preserve same functionality, set allow_default_user=True in all the cases where @LoginRequired was *not* followed by @NotAnonymous or other permission checks - that was done with some script hacks: sed -i 's/ @LoginRequired(\(..*\))/ @LoginRequired(\1, allow_default_user=True)/g' `hg mani` sed -i 's/ @LoginRequired()/ @LoginRequired(allow_default_user=True)/g' `hg mani` perl -0pi -e 's/\ @LoginRequired\(allow_default_user=True\)\n\s*\ @NotAnonymous\(\)/\ @LoginRequired()/g' `hg mani` perl -0pi -e 's/\ @LoginRequired\(allow_default_user=True\)(\n\s*\ @Has(Repo)?Permission)/\ @LoginRequired()\1/g' `hg mani` It has been reviewed that all uses of allow_default_user=True are in places where the there indeed wasn't any checking for default user before. These may or may not be correct, but now they are explicit and can be spotted and fixed. The few remaining uses of @NotAnonymous should probably be removed somehow.
|
|
|
domruf
|
205daed7185b
|
8 years ago
|
|
users: remove code that is unused after most autocomplete has been switched to ajax
@mention support still require _USERS_AC_DATA as a global variable.
|
|
|
Lars Kruse
|
7691290837d2
|
8 years ago
|
|
codingstyle: trivial whitespace fixes
Reported by flake8.
|
|
|
domruf
|
169dc4bd9d5b
|
9 years ago
|
|
repos: fix field form validation exception checking - it seems wrong to checking the exception type
Found by pylint. Will probably give better error messages in some cases.
|
|
|
Thomas De Schampheleire
|
4517e212f09a
|
9 years ago
|
|
controllers: rename __before__ to _before in preparation of TurboGears2
__before__ in Pylons is called _before in TurboGears2. We can prepare this rename already in Pylons-based Kallithea, so that the real TG2 migration commit just changes the BaseController.
Since TurboGears2 _before can pass extra arguments, we add *args and **kwargs parameters as well.
|
|
|
Mads Kiilerich
|
e9ac5698281d
|
9 years ago
|
|
tg: minimize future diff by some mocking and replacing some pylons imports with tg
No actual tg dependency yet, just a temporary hack faking tg as an alias for pylons.
Based on work by Alessandro Molina.
|
|
|
Søren Løvborg
|
33b71a130b16
|
9 years ago
|
|
templates: properly escape inline JavaScript values
TLDR: Kallithea has issues with escaping values for use in inline JS. Despite judicious poking of the code, no actual security vulnerabilities have been found, just lots of corner-case bugs. This patch fixes those, and hardens the code against actual security issues.
The long version:
To embed a Python value (typically a 'unicode' plain-text value) in a larger file, it must be escaped in a context specific manner. Example:
>>> s = u'<script>alert("It\'s a trap!");</script>'
1) Escaped for insertion into HTML element context
>>> print cgi.escape(s) <script>alert("It's a trap!");</script>
2) Escaped for insertion into HTML element or attribute context
>>> print h.escape(s) <script>alert("It's a trap!");</script>
This is the default Mako escaping, as usually used by Kallithea.
3) Encoded as JSON
>>> print json.dumps(s) "<script>alert(\"It's a trap!\");</script>"
4) Escaped for insertion into a JavaScript file
>>> print '(' + json.dumps(s) + ')' ("<script>alert(\"It's a trap!\");</script>")
The parentheses are not actually required for strings, but may be needed to avoid syntax errors if the value is a number or dict (object).
5) Escaped for insertion into a HTML inline <script> element
>>> print h.js(s) ("\x3cscript\x3ealert(\"It's a trap!\");\x3c/script\x3e")
Here, we need to combine JS and HTML escaping, further complicated by the fact that "<script>" tag contents can either be parsed in XHTML mode (in which case '<', '>' and '&' must additionally be XML escaped) or HTML mode (in which case '</script>' must be escaped, but not using HTML escaping, which is not available in HTML "<script>" tags). Therefore, the XML special characters (which can only occur in string literals) are escaped using JavaScript string literal escape sequences.
(This, incidentally, is why modern web security best practices ban all use of inline JavaScript...)
Unsurprisingly, Kallithea does not do (5) correctly. In most cases, Kallithea might slap a pair of single quotes around the HTML escaped Python value. A typical benign example:
$('#child_link').html('${_('No revisions')}');
This works in English, but if a localized version of the string contains an apostrophe, the result will be broken JavaScript. In the more severe cases, where the text is user controllable, it leaves the door open to injections. In this example, the script inserts the string as HTML, so Mako's implicit HTML escaping makes sense; but in many other cases, HTML escaping is actually an error, because the value is not used by the script in an HTML context.
The good news is that the HTML escaping thwarts attempts at XSS, since it's impossible to inject syntactically valid JavaScript of any useful complexity. It does allow JavaScript errors and gibberish to appear on the page, though.
In these cases, the escaping has been fixed to use either the new 'h.js' helper, which does JavaScript escaping (but not HTML escaping), OR the new 'h.jshtml' helper (which does both), in those cases where it was unclear if the value might be used (by the script) in an HTML context. Some of these can probably be "relaxed" from h.jshtml to h.js later, but for now, using h.jshtml fixes escaping and doesn't introduce new errors.
In a few places, Kallithea JSON encodes values in the controller, then inserts the JSON (without any further escaping) into <script> tags. This is also wrong, and carries actual risk of XSS vulnerabilities. However, in all cases, security vulnerabilities were narrowly avoided due to other filtering in Kallithea. (E.g. many special characters are banned from appearing in usernames.) In these cases, the escaping has been fixed and moved to the template, making it immediately visible that proper escaping has been performed.
Mini-FAQ (frequently anticipated questions):
Q: Why do everything in one big, hard to review patch? Q: Why add escaping in specific case FOO, it doesn't seem needed?
Because the goal here is to have "escape everywhere" as the default policy, rather than identifying individual bugs and fixing them one by one by adding escaping where needed. As such, this patch surely introduces a lot of needless escaping. This is no different from how Mako/Pylons HTML escape everything by default, even when not needed: it's errs on the side of needless work, to prevent erring on the side of skipping required (and security critical) work.
As for reviewability, the most important thing to notice is not where escaping has been introduced, but any places where it might have been missed (or where h.jshtml is needed, but h.js is used).
Q: The added escaping is kinda verbose/ugly.
That is not a question, but yes, I agree. Hopefully it'll encourage us to move away from inline JavaScript altogether. That's a significantly larger job, though; with luck this patch will keep us safe and secure until such a time as we can implement the real fix.
Q: Why not use Mako filter syntax ("${val|h.js}")?
Because of long-standing Mako bug #140, preventing use of 'h' in filters.
Q: Why not work around bug #140, or even use straight "${val|js}"?
Because Mako still applies the default h.escape filter before the explicitly specified filters.
Q: Where do we go from here?
Longer term, we should stop doing variable expansions in script blocks, and instead pass data to JS via e.g. data attributes, or asynchronously using AJAX calls. Once we've done that, we can remove inline JavaScript altogether in favor of separate script files, and set a strict Content Security Policy explicitly blocking inline scripting, and thus also the most common kind of cross-site scripting attack.
|
|
|
Søren Løvborg
|
10f16cf8289e
|
9 years ago
|
|
cleanup: remove SQLAlchemy session argument to action_logger
There's always a global SQLAlchemy session associated with the current thread; using another session for a single function call does not make any sense (as sessions cannot be mixed), unless the code works carefully to ensure the two sessions (and all objects loaded from them) are kept completely separate. Suffice to say that Kallithea does no such thing, thus there's no need to pretend to support multiple concurrent sessions.
|
|
|
Søren Løvborg
|
b4d1e85265c1
|
9 years ago
|
|
auth: simplify repository group permission checks
In practice, Kallithea has the 'group.admin' permission imply the 'group.write' permission, which again implies 'group.read'.
This codifies this practice by replacing HasRepoGroupPermissionAny "perm function" with the new HasRepoGroupLevel function, reducing the risk of errors and saving quite a lot of typing.
|
|
|
Søren Løvborg
|
a17c8e5f6712
|
9 years ago
|
|
auth: simplify repository permission checks
In practice, Kallithea has the 'repository.admin' permission imply the 'repository.write' permission, which again implies 'repository.read'.
This codifies/enforces this practice by replacing HasRepoPermissionAny "perm function" with the new HasRepositoryLevel function, reducing the risk of errors and saving quite a lot of typing.
|
|
|
Mads Kiilerich
|
3dcf1f82311a
|
9 years ago
|
|
controllers: avoid setting request state in controller instances - set it in the thread global request variable
In TurboGears, controllers are singletons and we should avoid using instance variables for any volatile data. Instead, use the "global thread local" request context.
With everything in request, some use of c is dropped.
Note: kallithea/controllers/api/__init__.py still use instance variables that will cause problems with TurboGears.
|
|
|
Thomas De Schampheleire
|
0122959e1f1d
|
9 years ago
|
|
lib: move jsonify from utils to base
Suggested by Mads Kiilerich.
The jsonify method is the only thing in utils that directly uses pylons. Move it to base where it fits better and we can use existing global imports.
|
|
|
Søren Løvborg
|
e99a33d7d7f5
|
9 years ago
|
|
cleanup: use obj.foo_id instead of obj.foo.foo_id
Don't use constructs like obj.user.user_id when obj.user_id works equally well (and potentially saves a database load).
|
|
|
Søren Løvborg
|
506dd480e408
|
9 years ago
|
|
db: always do case-insensitive sorting of repository names
We retain the implicit order_by on the follows_repository relationship. This is probably a bad idea, since it causes sorting even when it's not needed; but for now, at least, we consistently do case-insensitive sort.
|
|
|
Søren Løvborg
|
873a3839865d
|
9 years ago
|
|
|
|
|
Søren Løvborg
|
7c0b55fb3a85
|
9 years ago
|
|
controllers: remove redundant Repository database lookups
BaseRepoController already provides the repository object in c.db_repo (may be None) and BaseController already provides the repository name in c.repo_name (as given in the URL).
(Arguably, that's a bad design, and we should revisit that decision in the future. For now, the code just performs slightly better.)
|
|
|
Thomas De Schampheleire
|
af3539a458f6
|
9 years ago
|
|
Turbogears2 migration: replace pylons.url by kallithea.config.routing.url
In preparation for the migration to Turbogears2, introduce a kallithea.config.routing.url to replace pylons.url. The implementation is basically the same: wrap around routes.url().
This change involves: - a number of import statement changes - fixing some tests in test_libs.py; to avoid duplication, the different implementations of fake_url were grouped in one place.
This change was first proposed by Alessandro Molina in his initial port. Following changes were made afterwards: - move UrlGenerator from kallithea.lib.utils to kallithea.config.routing - add documentation to UrlGenerator - kallithea/lib/auth.py used url_for instead of url, for no apparent reason so this was changed. - fix libs tests - rebase onto Pylons-based Kallithea first
|
|
|
Mads Kiilerich
|
7e7db11d4e4d
|
9 years ago
|
|
celerypylons: wrap celery import so we always get the right environment variables set and check configuration
Get rid of magic ... or at least document and encapsulate it.
Before, celerypylons would set the environment variables that made it possible to import Celery after Pylons had been configured.
Now, the module will import Celery ... and verify that Pylons has been configured.
(A next stop could be to move things around so this got tied closely to initializing Pylons. Or something.)
|
|
|
Mads Kiilerich
|
81c13cdbe91f
|
9 years ago
|
|
celerylib: improve handling of sync results and get rid of BaseAsyncResult handling
A better wrapper of sync results simplifies the code.
Note: Results are currently not really used.
|
|
|
Mads Kiilerich
|
c0a3519e7d2c
|
9 years ago
|
|
controllers: remove pointless comments
These comments are mostly trivial and sometimes wrong. We don't want to maintain or pretend we do.
|
|
|
Søren Løvborg
|
09bcde0eee6d
|
9 years ago
|
|
auth: remove HasPermissionAll and variants
First, find all calls to HasPermissionAll with only a single permission given, and convert to equivalent calls to HasPermissionAny.
Next, observe that it's hard to envision situations requiring multiple permissions (of the same scope: global/repo/repo group) to be satisfied. Sufficiently hard that there are actually no such examples in the code.
Finally, considering that (should it ever be needed) HasPermissionAll can be trivially built as a conjunction of HasPermissionAny calls (the decorators, too) with only a small performance impact, simply remove HasPermissionAll and related classes and functions.
|
|
|
Mads Kiilerich
|
edb24bc0f71a
|
10 years ago
|
|
|
|
|
Søren Løvborg
|
d9b78d8f1db3
|
10 years ago
|
|
cleanup: replace redirect with WebOb exceptions
All redirect does is to log "Generating 302 redirect" with logging the actual location and raise a WebOb HTTPFound exception, and the logging is redundant, as WebOb exceptions and their status codes are already logged.
Instead, just raise the exception directly, which is both explicit and simpler (and finally, gets rid of "return redirect" which never really returns).
|
|
|
Mads Kiilerich
|
aa1891074dd6
|
10 years ago
|
|
cache: when invalidating a cache, always just delete all 'live cache' records instead of marking them inactive
Keep it simple. Adding the record again might be slightly more expensive than just updating the active flag but instead we get get a simpler model and automatic cleanup without using the cache-keys paster command.
|
|
|
Søren Løvborg
|
5cb3a07abbf4
|
10 years ago
|
|
|
|
|
Søren Løvborg
|
f6fcfc84f30c
|
10 years ago
|
|
spelling: unify messages for repository locking
Normalize phrasing and capitalization of repository locking messages. This also avoids the piecing together of sentence fragments in a way that can cause i18n headaches.
|
|
|
Søren Løvborg
|
aaa2478f9d60
|
10 years ago
|
|
|
|
|
Mads Kiilerich
|
7d0727d11104
|
10 years ago
|
|
cleanup: remove unused imports
Found with pyflakes.
|
|
|
Mads Kiilerich
|
d69aa464f373
|
10 years ago
|
|
cleanup: consistently use 'except ... as ...:'
Use the Python 2.6+ syntax instead of the old confusing 'except ..., ...' syntax.
|
|
|
Mads Kiilerich
|
ab5c4d84f99c
|
10 years ago
|
|
repos: fix abuse of dead 'repo' routing
The repo "show" controller didn't do anything and was unused. There was a routing GET entry for it but it was only used for generating URLs for DELETE and PUT operations that have separate controllers that happen to have the same URL.
Use the right routing entries when generating URLs and drop the dead code.
|
|
|
Mads Kiilerich
|
63bed817308c
|
10 years ago
|
|
cleanup: check for None object identity in cases where that is what the 'contract' says
Avoid applying bool() on complex objects - it might return something unexpected such as the key (which might be 0 and thus be false). Checking for None is more safe and faster.
|
|
|
Mads Kiilerich
|
cd655fbd79ce
|
10 years ago
|
|
|
|
|
Mads Kiilerich
|
28db71c6349e
|
10 years ago
|
|
scm: introduce AvailableRepoGroupChoices
Extract reusable code to reduce code duplication.
Note: groups_choices from the db module is only used from this function and should perhaps also be extracted ... but it is also closely related to other stuff that is (mis)placed in the db module so perhaps not ...
|
|
|
Mads Kiilerich
|
cb362e3439dd
|
10 years ago
|
|
repos: refactor repo group handling - extract generic functionality that can be used consistently
By using the right repo group list in the form, it is no longer possible for users to pick wrong repo creation locations ... and doing so anyway will be caught earlier on with a more generic error message at the specific place.
|
|
|
Mads Kiilerich
|
fdf6df128d89
|
10 years ago
|
|
remote: simplify clone_uri UI
The UI was a bit weird ... probably in an attempt of making it editable while hiding passwords. Instead, just show the URL with password hidden, and only save it back if it changed.
The UI only contains the clone_uri with passwords hidden. It will thus only be saved when the form result is different from the value that was shown to the user.
|
|
|
Mads Kiilerich
|
82faecc21324
|
10 years ago
|
|
|
|
|
Mads Kiilerich
|
f43dc1913984
|
10 years ago
|
|
|
|
|
Mads Kiilerich
|
3ba2a32292ec
|
10 years ago
|
|
|
|
|
Mads Kiilerich
|
14e2291a8f0b
|
10 years ago
|
|
|
|
|
Thomas De Schampheleire
|
790f01320369
|
10 years ago
|
|
autocomplete: fix completion of repository owner
The owner field of a repository setting was supposed to be autocompletable, but never really did (at least not in Kallithea, probably it once did in Rhodecode).
Instead of making yet another 'OwnerAutoComplete', make a generic SimpleUserAutoComplete that can be reused in other places that only need completion of a text input field.
|
|
|
Mads Kiilerich
|
959a9fa7d1a1
|
11 years ago
|
|
|
|
|
Mads Kiilerich
|
c04c2734e32f
|
11 years ago
|
|
controllers: consistently use formfill.render with force_defaults=False
The inconsistency could cause confusion for developers. It seems to me like force_defaults=False should be the default ... and apparently it was that in older versions of formfill.
It could perhaps make sense for us to have a wrapper that added the defualt values once, instead of repeating it all over ;-)
|
|
|
Thomas De Schampheleire
|
0bc8975f5365
|
11 years ago
|
|
|
|
|
Mads Kiilerich
|
ee43e19c18b7
|
12 years ago
|
|
|
|
|
Bradley M. Kuhn
|
24c0d584ba86
|
11 years ago
|
|
|
|
|
Bradley M. Kuhn
|
1948ede028ef
|
11 years ago
|
|
|
|
|
Bradley M. Kuhn
|
ad38f9f93b3b
|
11 years ago
|
|
Correct licensing information in individual files.
The top-level license file is now LICENSE.md.
Also, in various places where there should have been joint copyright holders listed, a single copyright holder was listed. It does not appear easy to add a link to a large list of copyright holders in these places, so it simply refers to the fact that various authors hold copyright.
In future, if an easy method is discovered to link to a list from those places, we should do so.
Finally, text is added to LICENSE.md to point to where the full list of copyright holders is, and that Kallithea as a whole is GPLv3'd.
|
|
|
Bradley M. Kuhn
|
9daad8c50b37
|
11 years ago
|
|
|
|
|
Bradley M. Kuhn
|
d208416c84c6
|
11 years ago
|
|
|
|
|
Bradley M. Kuhn
|
d1addaf7a91e
|
11 years ago
|
|
Second step in two-part process to rename directories. This is the actual directory rename.
|