Changeset - b0bd3332b715
[Not reviewed]
Merge stable
5 281 20
Thomas De Schampheleire - 6 years ago 2019-11-27 20:35:19
thomas.de_schampheleire@nokia.com
merge default to stable for 0.5.0
81 files changed:
README.rst
10
10
Changeset was too big and was cut off... Show full diff anyway
0 comments (0 inline, 0 general)
.hgignore
Show inline comments
 
@@ -6,6 +6,9 @@ syntax: glob
 
*.egg-info
 
*.egg
 
*.mo
 
*.orig
 
*.rej
 
*.bak
 
.eggs/
 
tarballcache/
 

	
 
@@ -23,6 +26,7 @@ syntax: regexp
 
^\.coverage$
 
^kallithea/front-end/node_modules$
 
^kallithea/front-end/package-lock\.json$
 
^kallithea/front-end/theme\.less$
 
^kallithea/front-end/tmp$
 
^kallithea/public/codemirror$
 
^kallithea/public/css/select2-spinner\.gif$
 
@@ -40,7 +44,6 @@ syntax: regexp
 
^kallithea/public/js/jquery\.flot\.time\.js$
 
^kallithea/public/js/jquery\.min\.js$
 
^kallithea/public/js/select2\.js$
 
^theme\.less$
 
^kallithea\.db$
 
^test\.db$
 
^Kallithea\.egg-info$
CONTRIBUTORS
Show inline comments
 
@@ -8,8 +8,16 @@ List of contributors to Kallithea projec
 
    ssantos <ssantos@web.de> 2018-2019
 
    Danni Randeris <danniranderis@gmail.com> 2019
 
    Edmund Wong <ewong@crazy-cat.org> 2019
 
    Elizabeth Sherrock <lizzyd710@gmail.com> 2019
 
    Hüseyin Tunç <huseyin.tunc@bulutfon.com> 2019
 
    leela <53352@protonmail.com> 2019
 
    Manuel Jacob <me@manueljacob.de> 2019
 
    Mateusz Mendel <mendelm9@gmail.com> 2019
 
    Nathan <bonnemainsnathan@gmail.com> 2019
 
    Oleksandr Shtalinberg <o.shtalinberg@gmail.com> 2019
 
    THANOS SIOURDAKIS <siourdakisthanos@gmail.com> 2019
 
    Wolfgang Scherer <wolfgang.scherer@gmx.de> 2019
 
    Христо Станев <hstanev@gmail.com> 2019
 
    Dominik Ruf <dominikruf@gmail.com> 2012 2014-2018
 
    Michal Čihař <michal@cihar.com> 2014-2015 2018
 
    Branko Majic <branko@majic.rs> 2015 2018
 
@@ -49,6 +57,7 @@ List of contributors to Kallithea projec
 
    YFdyh000 <yfdyh000@gmail.com> 2016
 
    Aras Pranckevičius <aras@unity3d.com> 2012-2013 2015
 
    Sean Farley <sean.michael.farley@gmail.com> 2013-2015
 
    Bradley M. Kuhn <bkuhn@sfconservancy.org> 2014-2015
 
    Christian Oyarzun <oyarzun@gmail.com> 2014-2015
 
    Joseph Rivera <rivera.d.joseph@gmail.com> 2014-2015
 
    Anatoly Bubenkov <bubenkoff@gmail.com> 2015
 
@@ -78,40 +87,58 @@ List of contributors to Kallithea projec
 
    Tuux <tuxa@galaxie.eu.org> 2015
 
    Viktar Palstsiuk <vipals@gmail.com> 2015
 
    Ante Ilic <ante@unity3d.com> 2014
 
    Bradley M. Kuhn <bkuhn@sfconservancy.org> 2014
 
    Calinou <calinou@opmbx.org> 2014
 
    Daniel Anderson <daniel@dattrix.com> 2014
 
    Henrik Stuart <hg@hstuart.dk> 2014
 
    Ingo von Borstel <kallithea@planetmaker.de> 2014
 
    invision70 <invision70@gmail.com> 2014
 
    Jelmer Vernooij <jelmer@samba.org> 2014
 
    Jim Hague <jim.hague@acm.org> 2014
 
    Matt Fellows <kallithea@matt-fellows.me.uk> 2014
 
    Max Roman <max@choloclos.se> 2014
 
    Na'Tosha Bard <natosha@unity3d.com> 2014
 
    Rasmus Selsmark <rasmuss@unity3d.com> 2014
 
    SkryabinD <skryabind@gmail.com> 2014
 
    Tim Freund <tim@freunds.net> 2014
 
    Travis Burtrum <android@moparisthebest.com> 2014
 
    whosaysni <whosaysni@gmail.com> 2014
 
    Zoltan Gyarmati <mr.zoltan.gyarmati@gmail.com> 2014
 
    Marcin Kuźmiński <marcin@python-works.com> 2010-2013
 
    Nemcio <areczek01@gmail.com> 2012-2013
 
    xpol <xpolife@gmail.com> 2012-2013
 
    Andrey Mivrenik <myvrenik@gmail.com> 2013
 
    Aparkar <aparkar@icloud.com> 2013
 
    ArcheR <aleclitvinov1980@gmail.com> 2013
 
    Dennis Brakhane <brakhane@googlemail.com> 2013
 
    gnustavo <gustavo@gnustavo.com> 2013
 
    Grzegorz Rożniecki <xaerxess@gmail.com> 2013
 
    Ilya Beda <ir4y.ix@gmail.com> 2013
 
    ivlevdenis <ivlevdenis.ru@gmail.com> 2013
 
    Jonathan Sternberg <jonathansternberg@gmail.com> 2013
 
    Leonardo Carneiro <leonardo@unity3d.com> 2013
 
    Magnus Ericmats <magnus.ericmats@gmail.com> 2013
 
    Martin Vium <martinv@unity3d.com> 2013
 
    Mikhail Zholobov <legal90@gmail.com> 2013
 
    mokeev1995 <mokeev_andre@mail.ru> 2013
 
    Ruslan Bekenev <furyinbox@gmail.com> 2013
 
    shirou - しろう 2013
 
    Simon Lopez <simon.lopez@slopez.org> 2013
 
    softforwinxp <softforwinxp@gmail.com> 2013
 
    stephanj <info@stephan-jauernick.de> 2013
 
    Ton Plomp <tcplomp@gmail.com> 2013
 
    zhmylove <zhmylove@narod.ru> 2013
 
    こいんとす <tkondou@gmail.com> 2013
 
    Augusto Herrmann <augusto.herrmann@planejamento.gov.br> 2011-2012
 
    Augusto Herrmann <augusto.herrmann@gmail.com> 2012
 
    Dan Sheridan <djs@adelard.com> 2012
 
    Dies Koper <diesk@fast.au.fujitsu.com> 2012
 
    Erwin Kroon <e.kroon@smartmetersolutions.nl> 2012
 
    H Waldo G <gwaldo@gmail.com> 2012
 
    hppj <hppj@postmage.biz> 2012
 
    Indra Talip <indra.talip@gmail.com> 2012
 
    mikespook 2012
 
    mikespook <mikespook@gmail.com> 2012
 
    nansenat16 <nansenat16@null.tw> 2012
 
    Nemcio <bogdan114@g.pl> 2012
 
    Philip Jameson <philip.j@hostdime.com> 2012
 
    Raoul Thill <raoul.thill@gmail.com> 2012
 
    Stefan Engel <mail@engel-stefan.de> 2012
Jenkinsfile
Show inline comments
 
@@ -44,8 +44,7 @@ node {
 
    }
 
    stage('setup') {
 
        def virtualenvscript = """$activatevirtualenv
 
            pip install --upgrade -e .
 
            pip install -r dev_requirements.txt
 
            pip install --upgrade -e . -r dev_requirements.txt
 
            python setup.py compile_catalog
 
            """
 
        if (isUnix()) {
README.rst
Show inline comments
 
@@ -8,17 +8,15 @@ About
 

	
 
**Kallithea** is a fast and powerful management tool for Mercurial_ and Git_
 
with a built-in push/pull server, full text search and code-review. It works on
 
http/https and has a built in permission/authentication system with the ability
 
HTTP/HTTPS and SSH, has a built-in permission/authentication system with the ability
 
to authenticate via LDAP or ActiveDirectory. Kallithea also provides simple API
 
so it's easy to integrate with existing external systems.
 

	
 
Kallithea is similar in some respects to GitHub_ or Bitbucket_, however
 
Kallithea can be run as standalone hosted application on your own server. It is
 
open-source donationware and focuses more on providing a customised,
 
open-source and focuses more on providing a customised,
 
self-administered interface for Mercurial_ and Git_ repositories. Kallithea
 
works on Unix-like systems and Windows, and is powered by the vcs_ library
 
created by Łukasz Balcerzak and Marcin Kuźmiński to uniformly handle multiple
 
version control systems.
 
works on Unix-like systems and Windows.
 

	
 
Kallithea was forked from RhodeCode in July 2014 and has been heavily modified.
 

	
 
@@ -26,7 +24,7 @@ Kallithea was forked from RhodeCode in J
 
Installation
 
------------
 

	
 
Kallithea requires Python_ 2.x and it is recommended to install it in a
 
Kallithea requires Python_ 2.7 and it is recommended to install it in a
 
virtualenv_. Official releases of Kallithea can be installed with::
 

	
 
    pip install kallithea
 
@@ -62,7 +60,8 @@ Kallithea features
 
  request is authenticated and logged together with IP address.
 
- Built for speed and performance. You can make multiple pulls/pushes
 
  simultaneously. Proven to work with thousands of repositories and users.
 
- Supports http/https, LDAP, AD, proxy-pass authentication.
 
- Supports HTTP/HTTPS with LDAP, AD, or proxy-pass authentication.
 
- Supports SSH access with server-side public key management.
 
- Full permissions (private/read/write/admin) together with IP restrictions for
 
  each repository, additional explicit forking, repositories group and
 
  repository creation permissions.
 
@@ -86,7 +85,7 @@ Kallithea features
 
  including Git_ binary-patches.
 
- Mercurial_ and Git_ DAG graphs and Flot-powered graphs with zooming and
 
  statistics to track activity for repositories.
 
- Admin interface with user/permission management. Admin activity journal, logs
 
- Admin interface with user/permission management. Admin activity journal logs
 
  pulls, pushes, forks, registrations and other actions made by all users.
 
- Server side forks. It is possible to fork a project and modify it freely
 
  without breaking the main repository.
 
@@ -102,7 +101,9 @@ Kallithea features
 
- Optional async tasks for speed and performance using Celery_.
 
- Backup scripts can do backup of whole app and send it over scp to desired
 
  location.
 
- Based on Pylons, SQLAlchemy, SQLite, Whoosh, vcs.
 
- Based on TurboGears2, SQLAlchemy, Whoosh, Bootstrap, and other open source
 
  libraries.
 
- Uses PostgreSQL, SQLite, or MariaDB/MySQL databases.
 

	
 

	
 
License
 
@@ -181,6 +182,5 @@ of Kallithea.
 
.. _Subversion: http://subversion.tigris.org/
 
.. _Git: http://git-scm.com/
 
.. _Celery: http://celeryproject.org/
 
.. _vcs: http://pypi.python.org/pypi/vcs
 
.. _Software Freedom Conservancy: http://sfconservancy.org/
 
.. _Puppet module: https://forge.puppetlabs.com/rauch/kallithea
conftest.py
Show inline comments
 
new file 100644
 
import os
 

	
 
import mock
 
import pytest
 

	
 

	
 
here = os.path.dirname(__file__)
 

	
 
def pytest_ignore_collect(path):
 
    # ignore all files outside the 'kallithea' directory
 
    if not str(path).startswith(os.path.join(here, 'kallithea')):
 
        return True
 

	
 
    # during doctest verification, normally all python files will be imported.
 
    # Thus, files that cannot be imported normally should be ignored.
 
    # Files that generate ImportErrors are ignored via
 
    # '--doctest-ignore-import-errors' (pytest.ini)
 
    kallithea_ignore_paths = (
 
        # AttributeError: 'module' object has no attribute 'config'
 
        '/kallithea/alembic/env.py',
 
        # collection of the following file messes up the rest of test execution
 
        '/kallithea/tests/scripts/manual_test_concurrency.py',
 
    )
 
    if str(path).endswith(kallithea_ignore_paths):
 
        return True
 

	
 
@pytest.fixture()
 
def doctest_mock_ugettext(request):
 
    """Mock ugettext ('_') in the module using this fixture.
 

	
 
    Intended to be used for doctests.
 

	
 
    In a doctest, enable this fixture using:
 
        >>> getfixture('doctest_mock_ugettext')
 
    """
 
    m = __import__(request.module.__name__, globals(), locals(), [None], 0)
 
    with mock.patch.object(m, '_', lambda s: s):
 
        yield
dev_requirements.txt
Show inline comments
 
pytest >= 3.3.0, < 3.8
 
pytest-runner < 4.3
 
pytest-sugar >= 0.7.0, < 0.10
 
pytest-benchmark < 3.2
 
pytest-localserver < 0.5
 
mock < 2.1
 
Sphinx < 1.8
 
WebTest < 2.1
 
pytest >= 4.6.6, < 4.7
 
pytest-sugar >= 0.9.2, < 0.10
 
pytest-benchmark >= 3.2.2, < 3.3
 
pytest-localserver >= 0.5.0, < 0.6
 
mock >= 3.0.0, < 3.1
 
Sphinx >= 1.8.0, < 1.9
 
WebTest >= 2.0.3, < 2.1
 
isort == 4.3.21
development.ini
Show inline comments
 
@@ -153,18 +153,6 @@ show_revision_number = false
 
## Kallithea url, ie. http[s]://kallithea.example.com/_admin/gists/<gistid>
 
gist_alias_url =
 

	
 
## white list of API enabled controllers. This allows to add list of
 
## controllers to which access will be enabled by api_key. eg: to enable
 
## api access to raw_files put `FilesController:raw`, to enable access to patches
 
## add `ChangesetController:changeset_patch`. This list should be "," separated
 
## Syntax is <ControllerClass>:<function>. Check debug logs for generated names
 
## Recommended settings below are commented out:
 
api_access_controllers_whitelist =
 
#    ChangesetController:changeset_patch,
 
#    ChangesetController:changeset_raw,
 
#    FilesController:raw,
 
#    FilesController:archivefile
 

	
 
## default encoding used to convert from and to unicode
 
## can be also a comma separated list of encoding in case of mixed encodings
 
default_encoding = utf-8
 
@@ -219,10 +207,6 @@ issue_sub =
 
## handling that. Set this variable to 403 to return HTTPForbidden
 
auth_ret_code =
 

	
 
## locking return code. When repository is locked return this HTTP code. 2XX
 
## codes don't break the transactions while 4XX codes do
 
lock_ret_code = 423
 

	
 
## allows to change the repository location in settings page
 
allow_repo_location_change = True
 

	
 
@@ -242,6 +226,25 @@ allow_custom_hooks_settings = True
 
#    CHANGELOG
 

	
 
####################################
 
###           SSH CONFIG        ####
 
####################################
 

	
 
## SSH is disabled by default, until an Administrator decides to enable it.
 
ssh_enabled = false
 

	
 
## File where users' SSH keys will be stored *if* ssh_enabled is true.
 
#ssh_authorized_keys = /home/kallithea/.ssh/authorized_keys
 

	
 
## Path to be used in ssh_authorized_keys file to invoke kallithea-cli with ssh-serve.
 
#kallithea_cli_path = /srv/kallithea/venv/bin/kallithea-cli
 

	
 
## Locale to be used in the ssh-serve command.
 
## This is needed because an SSH client may try to use its own locale
 
## settings, which may not be available on the server.
 
## See `locale -a` for valid values on this system.
 
#ssh_locale = C.UTF-8
 

	
 
####################################
 
###        CELERY CONFIG        ####
 
####################################
 

	
 
@@ -292,32 +295,43 @@ beaker.cache.sql_cache_short.key_length 
 

	
 
## Name of session cookie. Should be unique for a given host and path, even when running
 
## on different ports. Otherwise, cookie sessions will be shared and messed up.
 
beaker.session.key = kallithea
 
session.key = kallithea
 
## Sessions should always only be accessible by the browser, not directly by JavaScript.
 
beaker.session.httponly = true
 
session.httponly = true
 
## Session lifetime. 2592000 seconds is 30 days.
 
beaker.session.timeout = 2592000
 
session.timeout = 2592000
 

	
 
## Server secret used with HMAC to ensure integrity of cookies.
 
#beaker.session.secret = VERY-SECRET
 
beaker.session.secret = development-not-secret
 
#session.secret = VERY-SECRET
 
session.secret = development-not-secret
 
## Further, encrypt the data with AES.
 
#beaker.session.encrypt_key = <key_for_encryption>
 
#beaker.session.validate_key = <validation_key>
 
#session.encrypt_key = <key_for_encryption>
 
#session.validate_key = <validation_key>
 

	
 
## Type of storage used for the session, current types are
 
## dbm, file, memcached, database, and memory.
 

	
 
## File system storage of session data. (default)
 
#beaker.session.type = file
 
#session.type = file
 

	
 
## Cookie only, store all session data inside the cookie. Requires secure secrets.
 
#beaker.session.type = cookie
 
#session.type = cookie
 

	
 
## Database storage of session data.
 
#beaker.session.type = ext:database
 
#beaker.session.sa.url = postgresql://postgres:qwe@localhost/kallithea
 
#beaker.session.table_name = db_session
 
#session.type = ext:database
 
#session.sa.url = postgresql://postgres:qwe@localhost/kallithea
 
#session.table_name = db_session
 

	
 
############################
 
## ERROR HANDLING SYSTEMS ##
 
############################
 

	
 
# Propagate email settings to ErrorReporter of TurboGears2
 
# You do not normally need to change these lines
 
get trace_errors.error_email = email_to
 
get trace_errors.smtp_server = smtp_server
 
get trace_errors.smtp_port = smtp_port
 
get trace_errors.from_address = error_email_from
 

	
 
################################################################################
 
## WARNING: *DEBUG MODE MUST BE OFF IN A PRODUCTION ENVIRONMENT*              ##
 
@@ -361,7 +375,7 @@ script_location = kallithea:alembic
 
keys = root, routes, kallithea, sqlalchemy, tg, gearbox, beaker, templates, whoosh_indexer, werkzeug, backlash
 

	
 
[handlers]
 
keys = console, console_sql
 
keys = console, console_color, console_color_sql, null
 

	
 
[formatters]
 
keys = generic, color_formatter, color_formatter_sql
 
@@ -372,7 +386,10 @@ keys = generic, color_formatter, color_f
 

	
 
[logger_root]
 
level = NOTSET
 
handlers = console
 
#handlers = console
 
handlers = console_color
 
# For coloring based on log level:
 
# handlers = console_color
 

	
 
[logger_routes]
 
#level = WARN
 
@@ -380,67 +397,61 @@ level = DEBUG
 
handlers =
 
qualname = routes.middleware
 
## "level = DEBUG" logs the route matched and routing variables.
 
propagate = 1
 

	
 
[logger_beaker]
 
#level = WARN
 
level = DEBUG
 
handlers =
 
qualname = beaker.container
 
propagate = 1
 

	
 
[logger_templates]
 
#level = WARN
 
level = INFO
 
handlers =
 
qualname = pylons.templating
 
propagate = 1
 

	
 
[logger_kallithea]
 
#level = WARN
 
level = DEBUG
 
handlers =
 
qualname = kallithea
 
propagate = 1
 

	
 
[logger_tg]
 
#level = WARN
 
level = DEBUG
 
handlers =
 
qualname = tg
 
propagate = 1
 

	
 
[logger_gearbox]
 
#level = WARN
 
level = DEBUG
 
handlers =
 
qualname = gearbox
 
propagate = 1
 

	
 
[logger_sqlalchemy]
 
level = WARN
 
handlers = console_sql
 
handlers =
 
qualname = sqlalchemy.engine
 
propagate = 0
 
# For coloring based on log level and pretty printing of SQL:
 
# level = INFO
 
# handlers = console_color_sql
 
# propagate = 0
 

	
 
[logger_whoosh_indexer]
 
#level = WARN
 
level = DEBUG
 
handlers =
 
qualname = whoosh_indexer
 
propagate = 1
 

	
 
[logger_werkzeug]
 
level = WARN
 
handlers =
 
qualname = werkzeug
 
propagate = 1
 

	
 
[logger_backlash]
 
level = WARN
 
handlers =
 
qualname = backlash
 
propagate = 1
 

	
 
##############
 
## HANDLERS ##
 
@@ -449,15 +460,24 @@ propagate = 1
 
[handler_console]
 
class = StreamHandler
 
args = (sys.stderr,)
 
#formatter = generic
 
formatter = generic
 

	
 
[handler_console_color]
 
# ANSI color coding based on log level
 
class = StreamHandler
 
args = (sys.stderr,)
 
formatter = color_formatter
 

	
 
[handler_console_sql]
 
[handler_console_color_sql]
 
# ANSI color coding and pretty printing of SQL statements
 
class = StreamHandler
 
args = (sys.stderr,)
 
#formatter = generic
 
formatter = color_formatter_sql
 

	
 
[handler_null]
 
class = NullHandler
 
args = ()
 

	
 
################
 
## FORMATTERS ##
 
################
 
@@ -475,3 +495,21 @@ datefmt = %Y-%m-%d %H:%M:%S
 
class = kallithea.lib.colored_formatter.ColorFormatterSql
 
format = %(asctime)s.%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
 
datefmt = %Y-%m-%d %H:%M:%S
 

	
 
#################
 
## SSH LOGGING ##
 
#################
 

	
 
# The default loggers use 'handler_console' that uses StreamHandler with
 
# destination 'sys.stderr'. In the context of the SSH server process, these log
 
# messages would be sent to the client, which is normally not what you want.
 
# By default, when running ssh-serve, just use NullHandler and disable logging
 
# completely. For other logging options, see:
 
# https://docs.python.org/2/library/logging.handlers.html
 

	
 
[ssh_serve:logger_root]
 
level = CRITICAL
 
handlers = null
 

	
 
# Note: If logging is configured with other handlers, they might need similar
 
# muting for ssh-serve too.
docs/api/api.rst
Show inline comments
 
@@ -32,7 +32,7 @@ Clients must send JSON encoded JSON-RPC 
 
For example, to pull to a local "CPython" mirror using curl::
 

	
 
    curl https://kallithea.example.com/_admin/api -X POST -H 'content-type:text/plain' \
 
        --data-binary '{"id":1,"api_key":"xe7cdb2v278e4evbdf5vs04v832v0efvcbcve4a3","method":"pull","args":{"repo":"CPython"}}'
 
        --data-binary '{"id":1,"api_key":"xe7cdb2v278e4evbdf5vs04v832v0efvcbcve4a3","method":"pull","args":{"repoid":"CPython"}}'
 

	
 
In general, provide
 
 - *id*, a value of any type, can be used to match the response with the request that it is replying to.
 
@@ -162,37 +162,6 @@ OUTPUT::
 
    result : "Caches of repository `<reponame>`"
 
    error :  null
 

	
 
lock
 
^^^^
 

	
 
Set the locking state on the given repository by the given user.
 
If the param ``userid`` is skipped, it is set to the ID of the user who is calling this method.
 
If param ``locked`` is skipped, the current lock state of the repository is returned.
 
This command can only be executed using the api_key of a user with admin rights, or that of a regular user with admin or write access to the repository.
 

	
 
INPUT::
 

	
 
    id : <id_for_response>
 
    api_key : "<api_key>"
 
    method :  "lock"
 
    args :    {
 
                "repoid" : "<reponame or repo_id>"
 
                "userid" : "<user_id or username = Optional(=apiuser)>",
 
                "locked" : "<bool true|false = Optional(=None)>"
 
              }
 

	
 
OUTPUT::
 

	
 
    id : <id_given_in_input>
 
    result : {
 
                 "repo": "<reponame>",
 
                 "locked": "<bool true|false>",
 
                 "locked_since": "<float lock_time>",
 
                 "locked_by": "<username>",
 
                 "msg": "User `<username>` set lock state for repo `<reponame>` to `<false|true>`"
 
             }
 
    error :  null
 

	
 
get_ip
 
^^^^^^
 

	
 
@@ -601,7 +570,6 @@ OUTPUT::
 
                "repo_type" :        "<repo_type>",
 
                "clone_uri" :        "<clone_uri>",
 
                "enable_downloads":  "<bool>",
 
                "enable_locking":    "<bool>",
 
                "enable_statistics": "<bool>",
 
                "private":           "<bool>",
 
                "created_on" :       "<date_time_created>",
 
@@ -755,7 +723,6 @@ OUTPUT::
 
                "owner":             "<repo_owner>",
 
                "fork_of":           "<name_of_fork_parent>",
 
                "enable_downloads":  "<bool>",
 
                "enable_locking":    "<bool>",
 
                "enable_statistics": "<bool>",
 
              },
 
 
@@ -820,7 +787,6 @@ INPUT::
 
                "clone_uri" :        "<clone_uri> = Optional(None)",
 
                "landing_rev" :      "<landing_rev> = Optional('tip')",
 
                "enable_downloads":  "<bool> = Optional(False)",
 
                "enable_locking":    "<bool> = Optional(False)",
 
                "enable_statistics": "<bool> = Optional(False)",
 
              }
 

	
 
@@ -841,7 +807,6 @@ OUTPUT::
 
                "owner":             "<username or user_id>",
 
                "fork_of":           "<name_of_fork_parent>",
 
                "enable_downloads":  "<bool>",
 
                "enable_locking":    "<bool>",
 
                "enable_statistics": "<bool>",
 
              },
 
            }
 
@@ -870,7 +835,6 @@ INPUT::
 
                "clone_uri" :        "<clone_uri> = Optional(None)",
 
                "landing_rev" :      "<landing_rev> = Optional('tip')",
 
                "enable_downloads":  "<bool> = Optional(False)",
 
                "enable_locking":    "<bool> = Optional(False)",
 
                "enable_statistics": "<bool> = Optional(False)",
 
              }
 

	
 
@@ -891,7 +855,6 @@ OUTPUT::
 
                "owner":             "<username or user_id>",
 
                "fork_of":           "<name_of_fork_parent>",
 
                "enable_downloads":  "<bool>",
 
                "enable_locking":    "<bool>",
 
                "enable_statistics": "<bool>",
 
                "last_changeset":    {
 
                                       "author":   "<full_author>",
 
@@ -901,8 +864,6 @@ OUTPUT::
 
                                       "revision": "<numeric_revision>",
 
                                       "short_id": "<short_id>"
 
                                     }
 
                "locked_by": "<username>",
 
                "locked_date": "<float lock_time>",
 
              },
 
            }
 
    error:  null
 
@@ -1277,24 +1238,8 @@ OUTPUT::
 
API access for web views
 
------------------------
 

	
 
API access can also be turned on for each web view in Kallithea that is
 
decorated with the ``@LoginRequired`` decorator. Some views use
 
``@LoginRequired(api_access=True)`` and are always available. By default only
 
RSS/Atom feed views are enabled. Other views are
 
only available if they have been whitelisted. Edit the
 
``api_access_controllers_whitelist`` option in your .ini file and define views
 
that should have API access enabled.
 

	
 
For example, to enable API access to patch/diff, raw file and archive::
 

	
 
    api_access_controllers_whitelist =
 
        ChangesetController:changeset_patch,
 
        ChangesetController:changeset_raw,
 
        FilesController:raw,
 
        FilesController:archivefile
 

	
 
After this change, a Kallithea view can be accessed without login using
 
bearer authentication, by including this header with the request::
 
Kallithea HTTP entry points can also be accessed without login using bearer
 
authentication by including this header with the request::
 

	
 
    Authentication: Bearer <api_key>
 

	
docs/conf.py
Show inline comments
 
@@ -11,8 +11,11 @@
 
# All configuration values have a default; values that are commented out
 
# serve to show the default.
 

	
 
import os
 
import sys
 
import os
 

	
 
from kallithea import __version__
 

	
 

	
 
# If extensions (or modules to document with autodoc) are in another directory,
 
# add these directories to sys.path here. If the directory is relative to the
 
@@ -44,7 +47,7 @@ master_doc = 'index'
 

	
 
# General information about the project.
 
project = u'Kallithea'
 
copyright = u'2010-2016 by various authors, licensed as GPLv3.'
 
copyright = u'2010-2019 by various authors, licensed as GPLv3.'
 

	
 
# The version info for the project you're documenting, acts as replacement for
 
# |version| and |release|, also used in various other places throughout the
 
@@ -53,7 +56,6 @@ copyright = u'2010-2016 by various autho
 
# The short X.Y version.
 
root = os.path.dirname(os.path.dirname(__file__))
 
sys.path.append(root)
 
from kallithea import __version__
 
version = __version__
 
# The full version, including alpha/beta/rc tags.
 
release = __version__
docs/contributing.rst
Show inline comments
 
@@ -35,8 +35,7 @@ To get started with Kallithea developmen
 
        virtualenv ../kallithea-venv
 
        source ../kallithea-venv/bin/activate
 
        pip install --upgrade pip setuptools
 
        pip install --upgrade -e .
 
        pip install --upgrade -r dev_requirements.txt
 
        pip install --upgrade -e . -r dev_requirements.txt python-ldap python-pam
 
        kallithea-cli config-create my.ini
 
        kallithea-cli db-create -c my.ini --user=user --email=user@example.com --password=password --repos=/tmp
 
        kallithea-cli front-end-build
 
@@ -88,15 +87,13 @@ by invoking ``py.test`` from the project
 

	
 
    py.test
 

	
 
Note that testing on Python 2.6 also requires ``unittest2``.
 

	
 
Note that on unix systems, the temporary directory (``/tmp`` or where
 
``$TMPDIR`` points) must allow executable files; Git hooks must be executable,
 
and the test suite creates repositories in the temporary directory. Linux
 
systems with /tmp mounted noexec will thus fail.
 

	
 
You can also use ``tox`` to run the tests with all supported Python versions
 
(currently Python 2.6--2.7).
 
(currently only Python 2.7).
 

	
 
When running tests, Kallithea generates a `test.ini` based on template values
 
in `kallithea/tests/conftest.py` and populates the SQLite database specified
 
@@ -202,7 +199,7 @@ of Mercurial's (https://www.mercurial-sc
 
consistency with existing code. Run ``scripts/run-all-cleanup`` before
 
committing to ensure some basic code formatting consistency.
 

	
 
We support both Python 2.6.x and 2.7.x and nothing else. For now we don't care
 
We currently only support Python 2.7.x and nothing else. For now we don't care
 
about Python 3 compatibility.
 

	
 
We try to support the most common modern web browsers. IE9 is still supported
docs/index.rst
Show inline comments
 
@@ -63,7 +63,6 @@ User guide
 

	
 
   usage/general
 
   usage/vcs_notes
 
   usage/locking
 
   usage/statistics
 
   api/api
 

	
docs/installation.rst
Show inline comments
 
@@ -88,15 +88,6 @@ An additional benefit of virtualenv_ is 
 
   will "activate" a shell that terminates immediately. It is also perfectly
 
   acceptable (and desirable) to create a virtualenv as a normal user.
 

	
 
.. note:: Some dependencies are optional. If you need them, install them in
 
   the virtualenv too::
 

	
 
     pip install --upgrade psycopg2
 
     pip install --upgrade python-ldap
 

	
 
   This might require installation of development packages using your
 
   distribution's package manager.
 

	
 
- Make a folder for Kallithea data files, and configuration somewhere on the
 
  filesystem. For example::
 

	
 
@@ -106,8 +97,16 @@ An additional benefit of virtualenv_ is 
 

	
 
    pip install --upgrade kallithea
 

	
 
.. note:: Some dependencies are optional. If you need them, install them in
 
   the virtualenv too::
 

	
 
     pip install --upgrade kallithea python-ldap python-pam psycopg2
 

	
 
   This might require installation of development packages using your
 
   distribution's package manager.
 

	
 
  Alternatively, download a .tar.gz from http://pypi.python.org/pypi/Kallithea,
 
  extract it and run::
 
  extract it and install from source by running::
 

	
 
    pip install --upgrade .
 

	
docs/installation_win.rst
Show inline comments
 
@@ -17,11 +17,11 @@ To install on an older version of Window
 
Step 1 -- Install Python
 
^^^^^^^^^^^^^^^^^^^^^^^^
 

	
 
Install Python 2.x.y (x = 6 or 7). Latest version is recommended. If you need another version, they can run side by side.
 
Install Python 2.7.x. Latest version is recommended. If you need another version, they can run side by side.
 

	
 
.. warning:: Python 3.x is not supported.
 

	
 
- Download Python 2.x.y from http://www.python.org/download/
 
- Download Python 2.7.x from http://www.python.org/download/
 
- Choose and click on the version
 
- Click on "Windows X86-64 Installer" for x64 or "Windows x86 MSI installer" for Win32.
 
- Disable UAC or run the installer with admin privileges. If you chose to disable UAC, do not forget to reboot afterwards.
 
@@ -67,7 +67,7 @@ pip is a package management system for P
 

	
 
If you installed Python 2.7.9+, you already have it (as long as you ran the installer with admin privileges or disabled UAC).
 

	
 
If it was not installed or if you are using Python>=2.6,<2.7.9:
 
If it was not installed or if you are using Python < 2.7.9:
 

	
 
- Go to https://bootstrap.pypa.io
 
- Right-click on get-pip.py and choose Saves as...
docs/installation_win_old.rst
Show inline comments
 
@@ -60,8 +60,8 @@ choose "Visual C++ 2008 Express" when in
 
Step 2 -- Install Python
 
^^^^^^^^^^^^^^^^^^^^^^^^
 

	
 
Install Python 2.x.y (x = 6 or 7) x86 version (32-bit). DO NOT USE A 3.x version.
 
Download Python 2.x.y from:
 
Install Python 2.7.x x86 version (32-bit). DO NOT USE A 3.x version.
 
Download Python 2.7.x from:
 
http://www.python.org/download/
 

	
 
Choose "Windows Installer" (32-bit version) not "Windows X86-64
docs/overview.rst
Show inline comments
 
@@ -12,7 +12,7 @@ Python environment
 
------------------
 

	
 
**Kallithea** is written entirely in Python_ and requires Python version
 
2.6 or higher. Python 3.x is currently not supported.
 
2.7 or higher. Python 3.x is currently not supported.
 

	
 
Given a Python installation, there are different ways of providing the
 
environment for running Python applications. Each of them pretty much
docs/setup.rst
Show inline comments
 
@@ -92,36 +92,82 @@ set ``i18n.lang`` to the desired languag
 
Using Kallithea with SSH
 
------------------------
 

	
 
Kallithea currently only hosts repositories using http and https. (The addition
 
of ssh hosting is a planned future feature.) However you can easily use ssh in
 
parallel with Kallithea. (Repository access via ssh is a standard "out of
 
the box" feature of Mercurial_ and you can use this to access any of the
 
repositories that Kallithea is hosting. See PublishingRepositories_)
 
Kallithea supports repository access via SSH key based authentication.
 
This means:
 

	
 
- repository URLs like ``ssh://kallithea@example.com/name/of/repository``
 

	
 
- all network traffic for both read and write happens over the SSH protocol on
 
  port 22, without using HTTP/HTTPS nor the Kallithea WSGI application
 

	
 
- encryption and authentication protocols are managed by the system's ``sshd``
 
  process, with all users using the same Kallithea system user (e.g.
 
  ``kallithea``) when connecting to the SSH server, but with users' public keys
 
  in the Kallithea system user's `.ssh/authorized_keys` file granting each user
 
  sandboxed access to the repositories.
 

	
 
- users and admins can manage SSH public keys in the web UI
 

	
 
Kallithea repository structures are kept in directories with the same name
 
as the project. When using repository groups, each group is a subdirectory.
 
This allows you to easily use ssh for accessing repositories.
 
- in their SSH client configuration, users can configure how the client should
 
  control access to their SSH key - without passphrase, with passphrase, and
 
  optionally with passphrase caching in the local shell session (``ssh-agent``).
 
  This is standard SSH functionality, not something Kallithea provides or
 
  interferes with.
 

	
 
- network communication between client and server happens in a bidirectional
 
  stateful stream, and will in some cases be faster than HTTP/HTTPS with several
 
  stateless round-trips.
 

	
 
In order to use ssh you need to make sure that your web server and the users'
 
login accounts have the correct permissions set on the appropriate directories.
 
.. note:: At this moment, repository access via SSH has been tested on Unix
 
    only. Windows users that care about SSH are invited to test it and report
 
    problems, ideally contributing patches that solve these problems.
 

	
 
Users and admins can upload SSH public keys (e.g. ``.ssh/id_rsa.pub``) through
 
the web interface. The server's ``.ssh/authorized_keys`` file is automatically
 
maintained with an entry for each SSH key. Each entry will tell ``sshd`` to run
 
``kallithea-cli`` with the ``ssh-serve`` sub-command and the right Kallithea user ID
 
when encountering the corresponding SSH key.
 

	
 
.. note:: These permissions are independent of any permissions you
 
          have set up using the Kallithea web interface.
 
To enable SSH repository access, Kallithea must be configured with the path to
 
the ``.ssh/authorized_keys`` file for the Kallithea user, and the path to the
 
``kallithea-cli`` command. Put something like this in the ``.ini`` file::
 

	
 
    ssh_enabled = true
 
    ssh_authorized_keys = /home/kallithea/.ssh/authorized_keys
 
    kallithea_cli_path = /srv/kallithea/venv/bin/kallithea-cli
 

	
 
If your main directory (the same as set in Kallithea settings) is for
 
example set to ``/srv/repos`` and the repository you are using is
 
named ``kallithea``, then to clone via ssh you should run::
 
The SSH service must be running, and the Kallithea user account must be active
 
(not necessarily with password access, but public key access must be enabled),
 
all file permissions must be set as sshd wants it, and ``authorized_keys`` must
 
be writeable by the Kallithea user.
 

	
 
    hg clone ssh://user@kallithea.example.com/srv/repos/kallithea
 
.. note:: The ``authorized_keys`` file will be rewritten from scratch on
 
    each update. If it already exists with other data, Kallithea will not
 
    overwrite the existing ``authorized_keys``, and the server process will
 
    instead throw an exception. The system administrator thus cannot ssh
 
    directly to the Kallithea user but must use su/sudo from another account.
 

	
 
Using other external tools such as mercurial-server_ or using ssh key-based
 
authentication is fully supported.
 
    If ``/home/kallithea/.ssh/`` (the directory of the path specified in the
 
    ``ssh_authorized_keys`` setting of the ``.ini`` file) does not exist as a
 
    directory, Kallithea will attempt to create it. If that path exists but is
 
    *not* a directory, or is not readable-writable-executable by the server
 
    process, the server process will raise an exception each time it attempts to
 
    write the ``authorized_keys`` file.
 

	
 
.. note:: In an advanced setup, in order for your ssh access to use
 
          the same permissions as set up via the Kallithea web
 
          interface, you can create an authentication hook to connect
 
          to the Kallithea db and run check functions for permissions
 
          against that.
 
.. warning:: The handling of SSH access is steered directly by the command
 
    specified in the ``authorized_keys`` file. There is no interaction with the
 
    web UI.  Once SSH access is correctly configured and enabled, it will work
 
    regardless of whether the Kallithea web process is actually running. Hence,
 
    if you want to perform repository or server maintenance and want to fully
 
    disable all access to the repositories, disable SSH access by setting
 
    ``ssh_enabled = false`` in the correct ``.ini`` file (i.e. the ``.ini`` file
 
    specified in the ``authorized_keys`` file.)
 

	
 
The ``authorized_keys`` file can be updated manually with ``kallithea-cli
 
ssh-update-authorized-keys -c my.ini``. This command is not needed in normal
 
operation but is for example useful after changing SSH-related settings in the
 
``.ini`` file or renaming that file. (The path to the ``.ini`` file is used in
 
the generated ``authorized_keys`` file).
 

	
 

	
 
Setting up Whoosh full text search
docs/usage/customization.rst
Show inline comments
 
@@ -23,10 +23,11 @@ Style sheet customization with Less
 

	
 
Kallithea uses `Bootstrap 3`_ and Less_ for its style definitions. If you want
 
to make some customizations, we recommend to do so by creating a ``theme.less``
 
file. When you create a file named ``theme.less`` in the Kallithea root
 
directory, you can use this file to override the default style. For example,
 
you can use this to override ``@kallithea-theme-main-color``,
 
``@kallithea-logo-url`` or other `Bootstrap variables`_.
 
file. When you create a file named ``theme.less`` in directory
 
``kallithea/front-end/`` inside the Kallithea installation, you can use this
 
file to override the default style. For example, you can use this to override
 
``@kallithea-theme-main-color``, ``@kallithea-logo-url`` or other `Bootstrap
 
variables`_.
 

	
 
After creating the ``theme.less`` file, you need to regenerate the CSS files, by
 
running::
docs/usage/locking.rst
Show inline comments
 
deleted file
docs/usage/performance.rst
Show inline comments
 
@@ -23,6 +23,15 @@ Caching
 
Tweak beaker cache settings in the ini file. The actual effect of that is
 
questionable.
 

	
 
.. note::
 

	
 
    Beaker has no upper bound on cache size and will never drop any caches. For
 
    memory cache, the only option is to regularly restart the worker process.
 
    For file cache, it must be cleaned manually, as described in the `Beaker
 
    documentation <https://beaker.readthedocs.io/en/latest/sessions.html#removing-expired-old-sessions>`_::
 

	
 
        find data/cache -type f -mtime +30 -print -exec rm {} \;
 

	
 

	
 
Database
 
--------
kallithea/__init__.py
Show inline comments
 
@@ -27,10 +27,11 @@ Original author and date, and relevant c
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 

	
 
import platform
 
import sys
 
import platform
 

	
 

	
 
VERSION = (0, 4, 1)
 
VERSION = (0, 4, 99)
 
BACKENDS = {
 
    'hg': 'Mercurial repository',
 
    'git': 'Git repository',
 
@@ -44,14 +45,6 @@ CONFIG = {}
 
# Linked module for extensions
 
EXTENSIONS = {}
 

	
 
try:
 
    import kallithea.brand
 
except ImportError:
 
    pass
 
else:
 
    assert False, 'Database rebranding is no longer supported; see README.'
 

	
 

	
 
__version__ = '.'.join(str(each) for each in VERSION)
 
__platform__ = platform.system()
 
__license__ = 'GPLv3'
kallithea/alembic/versions/151b4a4e8c48_db_migration_step_after_93834966ae01_.py
Show inline comments
 
new file 100644
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# 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 General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
"""db: migration step after 93834966ae01 dropped non-nullable inherit_default_permissions
 

	
 
Revision ID: 151b4a4e8c48
 
Revises: b74907136bc1
 
Create Date: 2019-11-23 01:37:42.963119
 

	
 
"""
 

	
 
# The following opaque hexadecimal identifiers ("revisions") are used
 
# by Alembic to track this migration script and its relations to others.
 
revision = '151b4a4e8c48'
 
down_revision = 'b74907136bc1'
 
branch_labels = None
 
depends_on = None
 

	
 
import sqlalchemy as sa
 
from alembic import op
 

	
 

	
 
def upgrade():
 
    meta = sa.MetaData()
 
    meta.reflect(bind=op.get_bind())
 

	
 
    if 'inherit_default_permissions' in meta.tables['users'].columns:
 
        with op.batch_alter_table('users', schema=None) as batch_op:
 
            batch_op.drop_column('inherit_default_permissions')
 

	
 
    if 'users_group_inherit_default_permissions' in meta.tables['users_groups'].columns:
 
        with op.batch_alter_table('users_groups', schema=None) as batch_op:
 
            batch_op.drop_column('users_group_inherit_default_permissions')
 

	
 

	
 
def downgrade():
 
    with op.batch_alter_table('users_groups', schema=None) as batch_op:
 
        batch_op.add_column(sa.Column('users_group_inherit_default_permissions', sa.BOOLEAN(), nullable=False, default=True))
 

	
 
    with op.batch_alter_table('users', schema=None) as batch_op:
 
        batch_op.add_column(sa.Column('inherit_default_permissions', sa.BOOLEAN(), nullable=False, default=True))
kallithea/alembic/versions/4851d15bc437_db_migration_step_after_95c01895c006_.py
Show inline comments
 
new file 100644
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# 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 General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
"""db: migration step after 95c01895c006 failed to add usk_public_key_idx in alembic step b74907136bc1
 

	
 
Revision ID: 4851d15bc437
 
Revises: 151b4a4e8c48
 
Create Date: 2019-11-24 02:51:14.029583
 

	
 
"""
 

	
 
# The following opaque hexadecimal identifiers ("revisions") are used
 
# by Alembic to track this migration script and its relations to others.
 
revision = '4851d15bc437'
 
down_revision = '151b4a4e8c48'
 
branch_labels = None
 
depends_on = None
 

	
 
import sqlalchemy as sa
 
from alembic import op
 

	
 

	
 
def upgrade():
 
    meta = sa.MetaData()
 
    meta.reflect(bind=op.get_bind())
 

	
 
    if not any(i.name == 'usk_public_key_idx' for i in meta.tables['user_ssh_keys'].indexes):
 
        with op.batch_alter_table('user_ssh_keys', schema=None) as batch_op:
 
            batch_op.create_index('usk_public_key_idx', ['public_key'], unique=False)
 

	
 

	
 
def downgrade():
 
    with op.batch_alter_table('user_ssh_keys', schema=None) as batch_op:
 
        batch_op.drop_index('usk_public_key_idx')
kallithea/alembic/versions/a020f7044fd6_rename_hooks.py
Show inline comments
 
@@ -27,8 +27,10 @@ branch_labels = None
 
depends_on = None
 

	
 
from alembic import op
 
from sqlalchemy import MetaData, Table
 

	
 
from kallithea.model.db import Ui
 
from sqlalchemy import Table, MetaData
 

	
 

	
 
meta = MetaData()
 

	
kallithea/alembic/versions/ad357ccd9521_drop_locking.py
Show inline comments
 
new file 100644
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# 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 General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
"""Drop locking
 

	
 
Revision ID: ad357ccd9521
 
Revises: a020f7044fd6
 
Create Date: 2019-01-08
 

	
 
"""
 

	
 
# The following opaque hexadecimal identifiers ("revisions") are used
 
# by Alembic to track this migration script and its relations to others.
 
revision = 'ad357ccd9521'
 
down_revision = 'a020f7044fd6'
 
branch_labels = None
 
depends_on = None
 

	
 
import sqlalchemy as sa
 
from alembic import op
 
from sqlalchemy import MetaData, Table
 

	
 
from kallithea.model.db import Ui
 

	
 

	
 
meta = MetaData()
 

	
 

	
 
def upgrade():
 
    with op.batch_alter_table('groups', schema=None) as batch_op:
 
        batch_op.drop_column('enable_locking')
 

	
 
    with op.batch_alter_table('repositories', schema=None) as batch_op:
 
        batch_op.drop_column('locked')
 
        batch_op.drop_column('enable_locking')
 

	
 
    meta.bind = op.get_bind()
 
    ui = Table(Ui.__tablename__, meta, autoload=True)
 
    ui.delete().where(ui.c.ui_key == 'prechangegroup.push_lock_handling').execute()
 
    ui.delete().where(ui.c.ui_key == 'preoutgoing.pull_lock_handling').execute()
 

	
 

	
 
def downgrade():
 
    with op.batch_alter_table('repositories', schema=None) as batch_op:
 
        batch_op.add_column(sa.Column('enable_locking', sa.BOOLEAN(), nullable=False, default=False))
 
        batch_op.add_column(sa.Column('locked', sa.VARCHAR(length=255), nullable=True, default=False))
 

	
 
    with op.batch_alter_table('groups', schema=None) as batch_op:
 
        batch_op.add_column(sa.Column('enable_locking', sa.BOOLEAN(), nullable=False, default=False))
 

	
 
    # Note: not restoring hooks
kallithea/alembic/versions/b74907136bc1_create_table_for_ssh_keys.py
Show inline comments
 
new file 100644
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# 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 General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
"""Create table for ssh keys
 

	
 
Revision ID: b74907136bc1
 
Revises: a020f7044fd6
 
Create Date: 2017-04-03 18:54:24.490346
 

	
 
"""
 

	
 
# The following opaque hexadecimal identifiers ("revisions") are used
 
# by Alembic to track this migration script and its relations to others.
 
revision = 'b74907136bc1'
 
down_revision = 'ad357ccd9521'
 
branch_labels = None
 
depends_on = None
 

	
 
import sqlalchemy as sa
 
from alembic import op
 

	
 
from kallithea.model import db
 

	
 

	
 
def upgrade():
 
    op.create_table('user_ssh_keys',
 
        sa.Column('user_ssh_key_id', sa.Integer(), nullable=False),
 
        sa.Column('user_id', sa.Integer(), nullable=False),
 
        sa.Column('public_key', sa.UnicodeText(), nullable=False),
 
        sa.Column('description', sa.UnicodeText(), nullable=False),
 
        sa.Column('fingerprint', sa.String(length=255), nullable=False),
 
        sa.Column('created_on', sa.DateTime(), nullable=False),
 
        sa.Column('last_seen', sa.DateTime(), nullable=True),
 
        sa.ForeignKeyConstraint(['user_id'], ['users.user_id'], name=op.f('fk_user_ssh_keys_user_id')),
 
        sa.PrimaryKeyConstraint('user_ssh_key_id', name=op.f('pk_user_ssh_keys')),
 
        sa.UniqueConstraint('fingerprint', name=op.f('uq_user_ssh_keys_fingerprint')),
 
    )
 
    with op.batch_alter_table('user_ssh_keys', schema=None) as batch_op:
 
        batch_op.create_index('usk_fingerprint_idx', ['fingerprint'], unique=False)
 

	
 
    session = sa.orm.session.Session(bind=op.get_bind())
 
    if not session.query(db.Setting).filter(db.Setting.app_settings_name == 'clone_ssh_tmpl').all():
 
        setting = db.Setting('clone_ssh_tmpl', db.Repository.DEFAULT_CLONE_SSH, 'unicode')
 
        session.add(setting)
 
    session.commit()
 

	
 

	
 
def downgrade():
 
    with op.batch_alter_table('user_ssh_keys', schema=None) as batch_op:
 
        batch_op.drop_index('usk_fingerprint_idx')
 
    op.drop_table('user_ssh_keys')
kallithea/bin/base.py
Show inline comments
 
@@ -26,13 +26,14 @@ Original author and date, and relevant c
 
"""
 

	
 
import os
 
import sys
 
import pprint
 
import random
 
import sys
 
import urllib2
 
import pprint
 

	
 
from kallithea.lib.compat import json
 

	
 

	
 
CONFIG_NAME = '.config/kallithea'
 
FORMAT_PRETTY = 'pretty'
 
FORMAT_JSON = 'json'
kallithea/bin/kallithea_api.py
Show inline comments
 
@@ -25,10 +25,12 @@ Original author and date, and relevant c
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 

	
 
import sys
 
from __future__ import print_function
 

	
 
import argparse
 
import sys
 

	
 
from kallithea.bin.base import json, api_call, RcConf, FORMAT_JSON, FORMAT_PRETTY
 
from kallithea.bin.base import FORMAT_JSON, FORMAT_PRETTY, RcConf, api_call, json
 

	
 

	
 
def argparser(argv):
 
@@ -104,7 +106,7 @@ def main(argv=None):
 
        sys.stderr.write('Error parsing arguments \n')
 
        sys.exit()
 
    if args.format == FORMAT_PRETTY:
 
        print 'Calling method %s => %s' % (method, apihost)
 
        print('Calling method %s => %s' % (method, apihost))
 

	
 
    json_resp = api_call(apikey, apihost, method, **margs)
 
    error_prefix = ''
 
@@ -114,11 +116,11 @@ def main(argv=None):
 
    else:
 
        json_data = json_resp['result']
 
    if args.format == FORMAT_JSON:
 
        print json.dumps(json_data)
 
        print(json.dumps(json_data))
 
    elif args.format == FORMAT_PRETTY:
 
        print 'Server response \n%s%s' % (
 
        print('Server response \n%s%s' % (
 
            error_prefix, json.dumps(json_data, indent=4, sort_keys=True)
 
        )
 
        ))
 
    return 0
 

	
 

	
kallithea/bin/kallithea_backup.py
Show inline comments
 
@@ -26,14 +26,15 @@ Original author and date, and relevant c
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 

	
 
import datetime
 
import logging
 
import os
 
import subprocess
 
import sys
 
import logging
 
import tarfile
 
import datetime
 
import subprocess
 
import tempfile
 

	
 

	
 
logging.basicConfig(level=logging.DEBUG,
 
                    format="%(asctime)s %(levelname)-5.5s %(message)s")
 

	
kallithea/bin/kallithea_cli.py
Show inline comments
 
@@ -12,9 +12,6 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
# 'cli' is the main entry point for 'kallithea-cli', specified in setup.py as entry_points console_scripts
 
from kallithea.bin.kallithea_cli_base import cli
 

	
 
# import commands (they will add themselves to the 'cli' object)
 
import kallithea.bin.kallithea_cli_celery
 
import kallithea.bin.kallithea_cli_config
 
@@ -25,3 +22,6 @@ import kallithea.bin.kallithea_cli_iis
 
import kallithea.bin.kallithea_cli_index
 
import kallithea.bin.kallithea_cli_ishell
 
import kallithea.bin.kallithea_cli_repo
 
import kallithea.bin.kallithea_cli_ssh
 
# 'cli' is the main entry point for 'kallithea-cli', specified in setup.py as entry_points console_scripts
 
from kallithea.bin.kallithea_cli_base import cli
kallithea/bin/kallithea_cli_base.py
Show inline comments
 
@@ -12,21 +12,47 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import click
 
import cStringIO
 
import functools
 
import logging.config
 
import os
 
import re
 
import sys
 

	
 
import click
 
import paste.deploy
 

	
 
import kallithea
 
import logging.config
 
import paste.deploy
 

	
 

	
 
# kallithea_cli is usually invoked through the 'kallithea-cli' wrapper script
 
# that is installed by setuptools, as specified in setup.py console_scripts
 
# entry_points. The script will be using the right virtualenv (if any), and for
 
# Unix, it will contain #! pointing at the right python executable. The script
 
# also makes sure sys.argv[0] points back at the script path, and that is what
 
# can be used to invoke 'kallithea-cli' later.
 
kallithea_cli_path = sys.argv[0]
 

	
 

	
 
def read_config(ini_file_name, strip_section_prefix):
 
    """Read ini_file_name content, and for all sections like '[X:Y]' where X is
 
    strip_section_prefix, replace the section name with '[Y]'."""
 

	
 
    def repl(m):
 
        if m.group(1) == strip_section_prefix:
 
            return '[%s]' % m.group(2)
 
        return m.group(0)
 

	
 
    with open(ini_file_name) as f:
 
        return re.sub(r'^\[([^:]+):(.*)]', repl, f.read(), flags=re.MULTILINE)
 

	
 

	
 
# This placeholder is the main entry point for the kallithea-cli command
 
@click.group()
 
@click.group(context_settings=dict(help_option_names=['-h', '--help']))
 
def cli():
 
    """Various commands to manage a Kallithea instance."""
 

	
 
def register_command(config_file=False, config_file_initialize_app=False):
 
def register_command(config_file=False, config_file_initialize_app=False, hidden=False):
 
    """Register a kallithea-cli subcommand.
 

	
 
    If one of the config_file flags are true, a config file must be specified
 
@@ -36,7 +62,7 @@ def register_command(config_file=False, 
 
    If config_file_initialize_app is true, Kallithea, TurboGears global state
 
    (including tg.config), and database access will also be fully initialized.
 
    """
 
    cli_command = cli.command()
 
    cli_command = cli.command(hidden=hidden)
 
    if config_file or config_file_initialize_app:
 
        def annotator(annotated):
 
            @click.option('--config_file', '-c', help="Path to .ini file with app configuration.",
 
@@ -45,7 +71,8 @@ def register_command(config_file=False, 
 
            def runtime_wrapper(config_file, *args, **kwargs):
 
                path_to_ini_file = os.path.realpath(config_file)
 
                kallithea.CONFIG = paste.deploy.appconfig('config:' + path_to_ini_file)
 
                logging.config.fileConfig(path_to_ini_file)
 
                config_bytes = read_config(path_to_ini_file, strip_section_prefix=annotated.__name__)
 
                logging.config.fileConfig(cStringIO.StringIO(config_bytes))
 
                if config_file_initialize_app:
 
                    kallithea.config.middleware.make_app_without_logging(kallithea.CONFIG.global_conf, **kallithea.CONFIG.local_conf)
 
                    kallithea.lib.utils.setup_cache_regions(kallithea.CONFIG)
kallithea/bin/kallithea_cli_celery.py
Show inline comments
 
@@ -13,9 +13,10 @@
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import click
 

	
 
import kallithea
 
import kallithea.bin.kallithea_cli_base as cli_base
 

	
 
import kallithea
 

	
 
@cli_base.register_command(config_file_initialize_app=True)
 
@click.argument('celery_args', nargs=-1)
kallithea/bin/kallithea_cli_config.py
Show inline comments
 
@@ -12,18 +12,19 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import click
 
import kallithea.bin.kallithea_cli_base as cli_base
 

	
 
import os
 
import sys
 
import uuid
 
from collections import defaultdict
 

	
 
import click
 
import mako.exceptions
 

	
 
import kallithea.bin.kallithea_cli_base as cli_base
 
import kallithea.lib.locale
 
from kallithea.lib import inifile
 

	
 

	
 
def show_defaults(ctx, param, value):
 
    # Following construct is taken from the Click documentation:
 
    # https://click.palletsprojects.com/en/7.x/options/#callbacks-and-eager-options
 
@@ -62,6 +63,9 @@ def config_create(config_file, key_value
 

	
 
    mako_variable_values = {
 
        'git_hook_interpreter': sys.executable,
 
        'user_home_path': os.path.expanduser('~'),
 
        'kallithea_cli_path': cli_base.kallithea_cli_path,
 
        'ssh_locale': kallithea.lib.locale.get_current_locale(),
 
    }
 
    ini_settings = defaultdict(dict)
 

	
kallithea/bin/kallithea_cli_db.py
Show inline comments
 
@@ -12,12 +12,13 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
import click
 
import kallithea.bin.kallithea_cli_base as cli_base
 

	
 
import kallithea
 
import kallithea.bin.kallithea_cli_base as cli_base
 
from kallithea.lib.db_manage import DbManage
 
from kallithea.model.meta import Session
 

	
 

	
 
@cli_base.register_command(config_file=True)
 
@click.option('--user', help='Username of administrator account.')
 
@click.option('--password', help='Password for administrator account.')
 
@@ -57,8 +58,8 @@ def db_create(user, password, email, rep
 
    dbmanage = DbManage(dbconf=dbconf, root=kallithea.CONFIG['here'],
 
                        tests=False, cli_args=cli_args)
 
    dbmanage.create_tables(override=True)
 
    opts = dbmanage.config_prompt(None)
 
    dbmanage.create_settings(opts)
 
    repo_root_path = dbmanage.prompt_repo_root_path(None)
 
    dbmanage.create_settings(repo_root_path)
 
    dbmanage.create_default_user()
 
    dbmanage.admin_prompt()
 
    dbmanage.create_permissions()
kallithea/bin/kallithea_cli_extensions.py
Show inline comments
 
@@ -19,15 +19,16 @@ Original author and date, and relevant c
 
:copyright: (c) 2013 RhodeCode GmbH, and others.
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 
import os
 

	
 
import click
 
import kallithea.bin.kallithea_cli_base as cli_base
 

	
 
import os
 
import pkg_resources
 

	
 
import kallithea
 
import kallithea.bin.kallithea_cli_base as cli_base
 
from kallithea.lib.utils2 import ask_ok
 

	
 

	
 
@cli_base.register_command(config_file=True)
 
def extensions_create():
 
    """Write template file for extending Kallithea in Python.
kallithea/bin/kallithea_cli_front_end.py
Show inline comments
 
@@ -12,15 +12,16 @@
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import click
 
import kallithea.bin.kallithea_cli_base as cli_base
 

	
 
import json
 
import os
 
import shutil
 
import subprocess
 
import json
 

	
 
import click
 

	
 
import kallithea
 
import kallithea.bin.kallithea_cli_base as cli_base
 

	
 

	
 
@cli_base.register_command()
 
@click.option('--install-deps/--no-install-deps', default=True,
kallithea/bin/kallithea_cli_iis.py
Show inline comments
 
@@ -11,12 +11,14 @@
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
import os
 
import sys
 

	
 
import click
 

	
 
import kallithea
 
import kallithea.bin.kallithea_cli_base as cli_base
 

	
 
import os
 
import sys
 

	
 
dispath_py_template = '''\
 
# Created by Kallithea 'kallithea-cli iis-install'
kallithea/bin/kallithea_cli_index.py
Show inline comments
 
@@ -19,19 +19,19 @@ Original author and date, and relevant c
 
:copyright: (c) 2013 RhodeCode GmbH, and others.
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 
import click
 
import kallithea.bin.kallithea_cli_base as cli_base
 

	
 
import os
 
from string import strip
 
import sys
 

	
 
import click
 

	
 
import kallithea
 
import kallithea.bin.kallithea_cli_base as cli_base
 
from kallithea.lib.indexers.daemon import WhooshIndexingDaemon
 
from kallithea.lib.pidlock import LockHeld, DaemonLock
 
from kallithea.lib.pidlock import DaemonLock, LockHeld
 
from kallithea.lib.utils import load_rcextensions
 
from kallithea.model.repo import RepoModel
 

	
 

	
 
@cli_base.register_command(config_file_initialize_app=True)
 
@click.option('--repo-location', help='Base path of repositories to index. Default: all')
 
@click.option('--index-only', help='Comma-separated list of repositories to build index on. Default: all')
 
@@ -45,9 +45,9 @@ def index_create(repo_location, index_on
 

	
 
    if not repo_location:
 
        repo_location = RepoModel().repos_path
 
    repo_list = map(strip, index_only.split(',')) \
 
    repo_list = [x.strip() for x in index_only.split(',')] \
 
        if index_only else None
 
    repo_update_list = map(strip, update_only.split(',')) \
 
    repo_update_list = [x.strip() for x in update_only.split(',')] \
 
        if update_only else None
 

	
 
    try:
kallithea/bin/kallithea_cli_ishell.py
Show inline comments
 
@@ -19,21 +19,22 @@ Original author and date, and relevant c
 
:copyright: (c) 2013 RhodeCode GmbH, and others.
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 
import click
 
import kallithea.bin.kallithea_cli_base as cli_base
 

	
 
from __future__ import print_function
 

	
 
import sys
 

	
 
# make following imports directly available inside the ishell
 
import kallithea.bin.kallithea_cli_base as cli_base
 
from kallithea.model.db import *
 

	
 

	
 
@cli_base.register_command(config_file_initialize_app=True)
 
def ishell():
 
    """Interactive shell for Kallithea."""
 
    try:
 
        from IPython import embed
 
    except ImportError:
 
        print 'Kallithea ishell requires the Python package IPython 4 or later'
 
        print('Kallithea ishell requires the Python package IPython 4 or later')
 
        sys.exit(-1)
 
    from traitlets.config.loader import Config
 
    cfg = Config()
kallithea/bin/kallithea_cli_repo.py
Show inline comments
 
@@ -19,20 +19,21 @@ Original author and date, and relevant c
 
:copyright: (c) 2013 RhodeCode GmbH, and others.
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 
import click
 
import kallithea.bin.kallithea_cli_base as cli_base
 

	
 
import datetime
 
import os
 
import re
 
import shutil
 

	
 
from kallithea.lib.utils import repo2db_mapper, REMOVED_REPO_PAT
 
from kallithea.lib.utils2 import safe_unicode, safe_str, ask_ok
 
import click
 

	
 
import kallithea.bin.kallithea_cli_base as cli_base
 
from kallithea.lib.utils import REMOVED_REPO_PAT, repo2db_mapper
 
from kallithea.lib.utils2 import ask_ok, safe_str, safe_unicode
 
from kallithea.model.db import Repository, Ui
 
from kallithea.model.meta import Session
 
from kallithea.model.scm import ScmModel
 

	
 

	
 
@cli_base.register_command(config_file_initialize_app=True)
 
@click.option('--remove-missing', is_flag=True,
 
        help='Remove missing repositories from the Kallithea database.')
 
@@ -132,7 +133,8 @@ def repo_purge_deleted(ask, older_than):
 
        if ('.hg' in alldirs or
 
            '.git' in alldirs or
 
            '.svn' in alldirs or
 
            'objects' in alldirs and ('refs' in alldirs or 'packed-refs' in f)):
 
            'objects' in alldirs and ('refs' in alldirs or 'packed-refs' in f)
 
        ):
 
            continue
 
        for loc in alldirs:
 
            if REMOVED_REPO_PAT.match(loc):
kallithea/bin/kallithea_cli_ssh.py
Show inline comments
 
new file 100644
 
# -*- coding: utf-8 -*-
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# 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 General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import logging
 
import os
 
import re
 
import shlex
 
import sys
 

	
 
import click
 

	
 
import kallithea
 
import kallithea.bin.kallithea_cli_base as cli_base
 
from kallithea.lib.utils2 import str2bool
 
from kallithea.lib.vcs.backends.git.ssh import GitSshHandler
 
from kallithea.lib.vcs.backends.hg.ssh import MercurialSshHandler
 
from kallithea.model.ssh_key import SshKeyModel
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
@cli_base.register_command(config_file_initialize_app=True, hidden=True)
 
@click.argument('user-id', type=click.INT, required=True)
 
@click.argument('key-id', type=click.INT, required=True)
 
def ssh_serve(user_id, key_id):
 
    """Serve SSH repository protocol access.
 

	
 
    The trusted command that is invoked from .ssh/authorized_keys to serve SSH
 
    protocol access. The access will be granted as the specified user ID, and
 
    logged as using the specified key ID.
 
    """
 
    ssh_enabled = kallithea.CONFIG.get('ssh_enabled', False)
 
    if not str2bool(ssh_enabled):
 
        sys.stderr.write("SSH access is disabled.\n")
 
        return sys.exit(1)
 

	
 
    ssh_locale = kallithea.CONFIG.get('ssh_locale')
 
    if ssh_locale:
 
        os.environ['LC_ALL'] = ssh_locale # trumps everything, including LANG, except LANGUAGE
 
        os.environ['LANGUAGE'] = ssh_locale # trumps LC_ALL for GNU gettext message handling
 

	
 
    ssh_original_command = os.environ.get('SSH_ORIGINAL_COMMAND', '')
 
    client_ip = os.environ.get('SSH_CONNECTION', '').split(' ', 1)[0] or '0.0.0.0'
 
    log.debug('ssh-serve was invoked for SSH command %r from %s', ssh_original_command, client_ip)
 

	
 
    if not ssh_original_command:
 
        if os.environ.get('SSH_CONNECTION'):
 
            sys.stderr.write("'kallithea-cli ssh-serve' can only provide protocol access over SSH. Interactive SSH login for this user is disabled.\n")
 
        else:
 
            sys.stderr.write("'kallithea-cli ssh-serve' cannot be called directly. It must be specified as command in an SSH authorized_keys file.\n")
 
        return sys.exit(1)
 

	
 
    try:
 
        ssh_command_parts = shlex.split(ssh_original_command)
 
    except ValueError as e:
 
        sys.stderr.write('Error parsing SSH command %r: %s\n' % (ssh_original_command, e))
 
        sys.exit(1)
 
    for VcsHandler in [MercurialSshHandler, GitSshHandler]:
 
        vcs_handler = VcsHandler.make(ssh_command_parts)
 
        if vcs_handler is not None:
 
            vcs_handler.serve(user_id, key_id, client_ip)
 
            assert False # serve is written so it never will terminate
 

	
 
    sys.stderr.write("This account can only be used for repository access. SSH command %r is not supported.\n" % ssh_original_command)
 
    sys.exit(1)
 

	
 

	
 
@cli_base.register_command(config_file_initialize_app=True)
 
def ssh_update_authorized_keys():
 
    """Update .ssh/authorized_keys file.
 

	
 
    The file is usually maintained automatically, but this command will also re-write it.
 
    """
 

	
 
    SshKeyModel().write_authorized_keys()
kallithea/bin/kallithea_gist.py
Show inline comments
 
@@ -25,13 +25,15 @@ Original author and date, and relevant c
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 

	
 
import os
 
import sys
 
import stat
 
from __future__ import print_function
 

	
 
import argparse
 
import fileinput
 
import os
 
import stat
 
import sys
 

	
 
from kallithea.bin.base import json, api_call, RcConf, FORMAT_JSON, FORMAT_PRETTY
 
from kallithea.bin.base import FORMAT_JSON, FORMAT_PRETTY, RcConf, api_call, json
 

	
 

	
 
def argparser(argv):
 
@@ -144,11 +146,11 @@ def _run(argv):
 

	
 
        json_data = api_call(apikey, host, 'create_gist', **margs)['result']
 
        if args.format == FORMAT_JSON:
 
            print json.dumps(json_data)
 
            print(json.dumps(json_data))
 
        elif args.format == FORMAT_PRETTY:
 
            print json_data
 
            print 'Created %s gist %s' % (json_data['gist']['type'],
 
                                          json_data['gist']['url'])
 
            print(json_data)
 
            print('Created %s gist %s' % (json_data['gist']['type'],
 
                                          json_data['gist']['url']))
 
    return 0
 

	
 

	
 
@@ -164,7 +166,7 @@ def main(argv=None):
 
    try:
 
        return _run(argv)
 
    except Exception as e:
 
        print e
 
        print(e)
 
        return 1
 

	
 

	
kallithea/bin/ldap_sync.py
Show inline comments
 
@@ -25,13 +25,15 @@ Original author and date, and relevant c
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 

	
 
import ldap
 
from __future__ import print_function
 

	
 
import urllib2
 
import uuid
 
from ConfigParser import ConfigParser
 

	
 
import ldap
 
from kallithea.lib.compat import json
 

	
 
from ConfigParser import ConfigParser
 

	
 
config = ConfigParser()
 
config.read('ldap_sync.conf')
 
@@ -150,7 +152,7 @@ class LdapClient(object):
 
        self.client.simple_bind(user, key)
 
        self.base_dn = base_dn
 

	
 
    def __del__(self):
 
    def close(self):
 
        self.client.unbind()
 

	
 
    def get_groups(self):
 
@@ -238,10 +240,13 @@ class LdapSync(object):
 
                # TODO: handle somehow maybe..
 
                pass
 

	
 
    def close(self):
 
        self.ldap_client.close()
 

	
 

	
 
if __name__ == '__main__':
 
    sync = LdapSync()
 
    print sync.update_groups_from_ldap()
 
    print(sync.update_groups_from_ldap())
 

	
 
    for gr in sync.ldap_client.get_groups():
 
        # TODO: exception when user does not exist during add membership...
 
@@ -250,3 +255,5 @@ if __name__ == '__main__':
 
        # we need to find a way to recognize the right exception (we always get
 
        # ResponseError with no error code so maybe by return msg (?)
 
        sync.update_memberships_from_ldap(gr)
 

	
 
    sync.close()
kallithea/config/app_cfg.py
Show inline comments
 
@@ -17,30 +17,32 @@ Global configuration file for TurboGears
 
This file complements the .ini file.
 
"""
 

	
 
import logging
 
import os
 
import platform
 
import os, sys, logging
 
import sys
 

	
 
import alembic.config
 
import mercurial
 
import tg
 
from alembic.migration import MigrationContext
 
from alembic.script.base import ScriptDirectory
 
from sqlalchemy import create_engine
 
from tg import hooks
 
from tg.configuration import AppConfig
 
from tg.support.converters import asbool
 
import alembic.config
 
from alembic.script.base import ScriptDirectory
 
from alembic.migration import MigrationContext
 
from sqlalchemy import create_engine
 
import mercurial
 

	
 
import kallithea.lib.locale
 
import kallithea.model.base
 
from kallithea.lib.auth import set_available_permissions
 
from kallithea.lib.middleware.https_fixup import HttpsFixup
 
from kallithea.lib.middleware.permanent_repo_url import PermanentRepoUrl
 
from kallithea.lib.middleware.simplegit import SimpleGit
 
from kallithea.lib.middleware.simplehg import SimpleHg
 
from kallithea.lib.auth import set_available_permissions
 
from kallithea.lib.utils import load_rcextensions, make_ui, set_app_settings, set_vcs_config, \
 
    set_indexer_config, check_git_version, repo2db_mapper
 
from kallithea.lib.middleware.wrapper import RequestWrapper
 
from kallithea.lib.utils import check_git_version, load_rcextensions, make_ui, set_app_settings, set_indexer_config, set_vcs_config
 
from kallithea.lib.utils2 import str2bool
 
import kallithea.model.base
 
from kallithea.model.scm import ScmModel
 

	
 
import formencode
 

	
 
log = logging.getLogger(__name__)
 

	
 
@@ -120,19 +122,7 @@ else:
 
def setup_configuration(app):
 
    config = app.config
 

	
 
    # Verify that things work when Dulwich passes unicode paths to the file system layer.
 
    # Note: UTF-8 is preferred, but for example ISO-8859-1 or mbcs should also work under the right cirumstances.
 
    try:
 
        u'\xe9'.encode(sys.getfilesystemencoding()) # Test using é (&eacute;)
 
    except UnicodeEncodeError:
 
        log.error("Cannot encode Unicode paths to file system encoding %r", sys.getfilesystemencoding())
 
        for var in ['LC_CTYPE', 'LC_ALL', 'LANG']:
 
            if var in os.environ:
 
                val = os.environ[var]
 
                log.error("Note: Environment variable %s is %r - perhaps change it to some other value from 'locale -a', like 'C.UTF-8' or 'en_US.UTF-8'", var, val)
 
                break
 
        else:
 
            log.error("Note: No locale setting found in environment variables - perhaps set LC_CTYPE to some value from 'locale -a', like 'C.UTF-8' or 'en_US.UTF-8'")
 
    if not kallithea.lib.locale.current_locale_is_valid():
 
        log.error("Terminating ...")
 
        sys.exit(1)
 

	
 
@@ -166,14 +156,14 @@ def setup_configuration(app):
 
            sys.exit(1)
 

	
 
    # store some globals into kallithea
 
    kallithea.CELERY_ON = str2bool(config['app_conf'].get('use_celery'))
 
    kallithea.CELERY_EAGER = str2bool(config['app_conf'].get('celery.always.eager'))
 
    kallithea.CELERY_ON = str2bool(config.get('use_celery'))
 
    kallithea.CELERY_EAGER = str2bool(config.get('celery.always.eager'))
 
    kallithea.CONFIG = config
 

	
 
    load_rcextensions(root_path=config['here'])
 

	
 
    set_available_permissions(config)
 
    repos_path = make_ui('db').configitems('paths')[0][1]
 
    repos_path = make_ui().configitems('paths')[0][1]
 
    config['base_path'] = repos_path
 
    set_app_settings(config)
 

	
 
@@ -208,6 +198,13 @@ def setup_application(app):
 
    # Enable https redirects based on HTTP_X_URL_SCHEME set by proxy
 
    if any(asbool(config.get(x)) for x in ['https_fixup', 'force_https', 'use_htsts']):
 
        app = HttpsFixup(app, config)
 

	
 
    app = PermanentRepoUrl(app, config)
 

	
 
    # Optional and undocumented wrapper - gives more verbose request/response logging, but has a slight overhead
 
    if str2bool(config.get('use_wsgi_wrapper')):
 
        app = RequestWrapper(app, config)
 

	
 
    return app
 

	
 

	
kallithea/config/environment.py
Show inline comments
 
@@ -15,6 +15,7 @@
 

	
 
from kallithea.config.app_cfg import base_config
 

	
 

	
 
__all__ = ['load_environment']
 

	
 
# Use base_config to setup the environment loader function
kallithea/config/middleware.py
Show inline comments
 
@@ -14,9 +14,11 @@
 
"""WSGI middleware initialization for the Kallithea application."""
 

	
 
import logging.config
 

	
 
from kallithea.config.app_cfg import base_config
 
from kallithea.config.environment import load_environment
 

	
 

	
 
__all__ = ['make_app']
 

	
 
# Use base_config to setup the necessary PasteDeploy application factory.
kallithea/config/post_receive_tmpl.py
Show inline comments
 
@@ -11,6 +11,9 @@ hook will use.
 
import os
 
import sys
 

	
 
import kallithea.lib.hooks
 

	
 

	
 
# Set output mode on windows to binary for stderr.
 
# This prevents python (or the windows console) from replacing \n with \r\n.
 
# Git doesn't display remote output lines that contain \r,
 
@@ -22,7 +25,6 @@ if sys.platform == "win32":
 

	
 
KALLITHEA_HOOK_VER = '_TMPL_'
 
os.environ['KALLITHEA_HOOK_VER'] = KALLITHEA_HOOK_VER
 
import kallithea.lib.hooks
 

	
 

	
 
def main():
kallithea/config/pre_receive_tmpl.py
Show inline comments
 
@@ -11,6 +11,9 @@ hook will use.
 
import os
 
import sys
 

	
 
import kallithea.lib.hooks
 

	
 

	
 
# Set output mode on windows to binary for stderr.
 
# This prevents python (or the windows console) from replacing \n with \r\n.
 
# Git doesn't display remote output lines that contain \r,
 
@@ -22,7 +25,6 @@ if sys.platform == "win32":
 

	
 
KALLITHEA_HOOK_VER = '_TMPL_'
 
os.environ['KALLITHEA_HOOK_VER'] = KALLITHEA_HOOK_VER
 
import kallithea.lib.hooks
 

	
 

	
 
def main():
kallithea/config/rcextensions/__init__.py
Show inline comments
 
@@ -105,7 +105,6 @@ def _cruserhook(*args, **kwargs):
 
      :param active:
 
      :param password:
 
      :param emails:
 
      :param inherit_default_permissions:
 
      :param created_by:
 
    """
 
    return 0
 
@@ -169,7 +168,6 @@ def _dluserhook(*args, **kwargs):
 
      :param active:
 
      :param password:
 
      :param emails:
 
      :param inherit_default_permissions:
 
      :param deleted_by:
 
    """
 
    return 0
 
@@ -189,7 +187,6 @@ def _pushhook(*args, **kwargs):
 
    Post push hook
 
    kwargs available:
 

	
 
      :param server_url: url of instance that triggered this hook
 
      :param config: path to .ini config used
 
      :param scm: type of VS 'git' or 'hg'
 
      :param username: name of user who pushed
 
@@ -215,7 +212,6 @@ def _pullhook(*args, **kwargs):
 
    Post pull hook
 
    kwargs available::
 

	
 
      :param server_url: url of instance that triggered this hook
 
      :param config: path to .ini config used
 
      :param scm: type of VS 'git' or 'hg'
 
      :param username: name of user who pulled
kallithea/config/routing.py
Show inline comments
 
@@ -19,8 +19,9 @@ may take precedent over the more generic
 
refer to the routes manual at http://routes.groovie.org/docs/
 
"""
 

	
 
from routes import Mapper
 
from tg import request
 
from routes import Mapper
 

	
 

	
 
# prefix for non repository related links needs to be prefixed with `/`
 
ADMIN_PREFIX = '/_admin'
 
@@ -33,28 +34,18 @@ def make_map(config):
 
    rmap.minimization = False
 
    rmap.explicit = False
 

	
 
    from kallithea.lib.utils import (is_valid_repo, is_valid_repo_group,
 
                                     get_repo_by_id)
 
    from kallithea.lib.utils import is_valid_repo, is_valid_repo_group
 

	
 
    def check_repo(environ, match_dict):
 
        """
 
        check for valid repository for proper 404 handling
 

	
 
        :param environ:
 
        :param match_dict:
 
        Check for valid repository for proper 404 handling.
 
        Also, a bit of side effect modifying match_dict ...
 
        """
 
        repo_name = match_dict.get('repo_name')
 

	
 
        if match_dict.get('f_path'):
 
            # fix for multiple initial slashes that causes errors
 
            match_dict['f_path'] = match_dict['f_path'].lstrip('/')
 

	
 
        by_id_match = get_repo_by_id(repo_name)
 
        if by_id_match:
 
            repo_name = by_id_match
 
            match_dict['repo_name'] = repo_name
 

	
 
        return is_valid_repo(repo_name, config['base_path'])
 
        return is_valid_repo(match_dict['repo_name'], config['base_path'])
 

	
 
    def check_group(environ, match_dict):
 
        """
 
@@ -193,6 +184,13 @@ def make_map(config):
 
        m.connect("edit_user_api_keys_delete", "/users/{id}/edit/api_keys/delete",
 
                  action="delete_api_key", conditions=dict(method=["POST"]))
 

	
 
        m.connect("edit_user_ssh_keys", "/users/{id}/edit/ssh_keys",
 
                  action="edit_ssh_keys", conditions=dict(method=["GET"]))
 
        m.connect("edit_user_ssh_keys", "/users/{id}/edit/ssh_keys",
 
                  action="ssh_keys_add", conditions=dict(method=["POST"]))
 
        m.connect("edit_user_ssh_keys_delete", "/users/{id}/edit/ssh_keys/delete",
 
                  action="ssh_keys_delete", conditions=dict(method=["POST"]))
 

	
 
        m.connect("edit_user_perms", "/users/{id}/edit/permissions",
 
                  action="edit_perms", conditions=dict(method=["GET"]))
 
        m.connect("edit_user_perms_update", "/users/{id}/edit/permissions",
 
@@ -265,7 +263,7 @@ def make_map(config):
 
    # ADMIN DEFAULTS ROUTES
 
    with rmap.submapper(path_prefix=ADMIN_PREFIX,
 
                        controller='admin/defaults') as m:
 
        m.connect('defaults', 'defaults',
 
        m.connect('defaults', '/defaults',
 
                  action="index")
 
        m.connect('defaults_update', 'defaults/{id}/update',
 
                  action="update", conditions=dict(method=["POST"]))
 
@@ -321,8 +319,6 @@ def make_map(config):
 
                  action="settings_system", conditions=dict(method=["POST"]))
 
        m.connect("admin_settings_system", "/settings/system",
 
                  action="settings_system", conditions=dict(method=["GET"]))
 
        m.connect("admin_settings_system_update", "/settings/system/updates",
 
                  action="settings_system_update", conditions=dict(method=["GET"]))
 

	
 
    # ADMIN MY ACCOUNT
 
    with rmap.submapper(path_prefix=ADMIN_PREFIX,
 
@@ -361,6 +357,13 @@ def make_map(config):
 
        m.connect("my_account_api_keys_delete", "/my_account/api_keys/delete",
 
                  action="my_account_api_keys_delete", conditions=dict(method=["POST"]))
 

	
 
        m.connect("my_account_ssh_keys", "/my_account/ssh_keys",
 
                  action="my_account_ssh_keys", conditions=dict(method=["GET"]))
 
        m.connect("my_account_ssh_keys", "/my_account/ssh_keys",
 
                  action="my_account_ssh_keys_add", conditions=dict(method=["POST"]))
 
        m.connect("my_account_ssh_keys_delete", "/my_account/ssh_keys/delete",
 
                  action="my_account_ssh_keys_delete", conditions=dict(method=["POST"]))
 

	
 
    # ADMIN GIST
 
    with rmap.submapper(path_prefix=ADMIN_PREFIX,
 
                        controller='admin/gists') as m:
 
@@ -394,7 +397,7 @@ def make_map(config):
 
    with rmap.submapper(path_prefix=ADMIN_PREFIX,
 
                        controller='admin/admin') as m:
 
        m.connect('admin_home', '', action='index')
 
        m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}',
 
        m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9. _-]*}',
 
                  action='add_repo')
 
    #==========================================================================
 
    # API V2
 
@@ -443,7 +446,7 @@ def make_map(config):
 
                 )
 

	
 
    # LOGIN/LOGOUT/REGISTER/SIGN IN
 
    rmap.connect('authentication_token', '%s/authentication_token' % ADMIN_PREFIX, controller='login', action='authentication_token')
 
    rmap.connect('session_csrf_secret_token', '%s/session_csrf_secret_token' % ADMIN_PREFIX, controller='login', action='session_csrf_secret_token')
 
    rmap.connect('login_home', '%s/login' % ADMIN_PREFIX, controller='login')
 
    rmap.connect('logout_home', '%s/logout' % ADMIN_PREFIX, controller='login',
 
                 action='logout')
 
@@ -533,13 +536,6 @@ def make_map(config):
 
                 controller='admin/repos', action="edit_advanced",
 
                 conditions=dict(method=["GET"], function=check_repo))
 

	
 
    rmap.connect("edit_repo_advanced_locking", "/{repo_name:.*?}/settings/advanced/locking",
 
                 controller='admin/repos', action="edit_advanced_locking",
 
                 conditions=dict(method=["POST"], function=check_repo))
 
    rmap.connect('toggle_locking', "/{repo_name:.*?}/settings/advanced/locking_toggle",
 
                 controller='admin/repos', action="toggle_locking",
 
                 conditions=dict(method=["GET"], function=check_repo))
 

	
 
    rmap.connect("edit_repo_advanced_journal", "/{repo_name:.*?}/settings/advanced/journal",
 
                 controller='admin/repos', action="edit_advanced_journal",
 
                 conditions=dict(method=["POST"], function=check_repo))
kallithea/controllers/admin/admin.py
Show inline comments
 
@@ -28,20 +28,21 @@ Original author and date, and relevant c
 

	
 
import logging
 

	
 
from tg import request, tmpl_context as c
 
from sqlalchemy.orm import joinedload
 
from sqlalchemy.sql.expression import and_, func, or_
 
from tg import request
 
from tg import tmpl_context as c
 
from whoosh import query
 
from whoosh.qparser.dateparse import DateParserPlugin
 
from whoosh.qparser.default import QueryParser
 
from whoosh.qparser.dateparse import DateParserPlugin
 
from whoosh import query
 
from sqlalchemy.sql.expression import or_, and_, func
 

	
 
from kallithea.config.routing import url
 
from kallithea.model.db import UserLog
 
from kallithea.lib.auth import LoginRequired, HasPermissionAnyDecorator
 
from kallithea.lib.auth import HasPermissionAnyDecorator, LoginRequired
 
from kallithea.lib.base import BaseController, render
 
from kallithea.lib.utils2 import safe_int, remove_prefix, remove_suffix
 
from kallithea.lib.indexers import JOURNAL_SCHEMA
 
from kallithea.lib.page import Page
 
from kallithea.lib.utils2 import remove_prefix, remove_suffix, safe_int
 
from kallithea.model.db import UserLog
 

	
 

	
 
log = logging.getLogger(__name__)
kallithea/controllers/admin/auth_settings.py
Show inline comments
 
@@ -24,23 +24,25 @@ Original author and date, and relevant c
 
"""
 

	
 
import logging
 
import formencode.htmlfill
 
import traceback
 

	
 
from tg import request, tmpl_context as c
 
import formencode.htmlfill
 
from tg import request
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from webob.exc import HTTPFound
 

	
 
from kallithea.config.routing import url
 
from kallithea.lib import auth_modules
 
from kallithea.lib import helpers as h
 
from kallithea.lib.compat import formatted_json
 
from kallithea.lib.auth import HasPermissionAnyDecorator, LoginRequired
 
from kallithea.lib.base import BaseController, render
 
from kallithea.lib.auth import LoginRequired, HasPermissionAnyDecorator
 
from kallithea.lib import auth_modules
 
from kallithea.lib.compat import formatted_json
 
from kallithea.model.db import Setting
 
from kallithea.model.forms import AuthSettingsForm
 
from kallithea.model.db import Setting
 
from kallithea.model.meta import Session
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
kallithea/controllers/admin/defaults.py
Show inline comments
 
@@ -27,21 +27,22 @@ Original author and date, and relevant c
 

	
 
import logging
 
import traceback
 

	
 
import formencode
 
from formencode import htmlfill
 

	
 
from tg import request, tmpl_context as c
 
from tg import request
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from webob.exc import HTTPFound
 

	
 
from kallithea.config.routing import url
 
from kallithea.lib import helpers as h
 
from kallithea.lib.auth import LoginRequired, HasPermissionAnyDecorator
 
from kallithea.lib.auth import HasPermissionAnyDecorator, LoginRequired
 
from kallithea.lib.base import BaseController, render
 
from kallithea.model.db import Setting
 
from kallithea.model.forms import DefaultsForm
 
from kallithea.model.meta import Session
 
from kallithea import BACKENDS
 
from kallithea.model.db import Setting
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 
@@ -54,7 +55,6 @@ class DefaultsController(BaseController)
 
        super(DefaultsController, self)._before(*args, **kwargs)
 

	
 
    def index(self, format='html'):
 
        c.backends = BACKENDS.keys()
 
        defaults = Setting.get_default_repo_settings()
 

	
 
        return htmlfill.render(
kallithea/controllers/admin/gists.py
Show inline comments
 
@@ -25,27 +25,28 @@ Original author and date, and relevant c
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 

	
 
import time
 
import logging
 
import traceback
 

	
 
import formencode.htmlfill
 

	
 
from tg import request, response, tmpl_context as c
 
from sqlalchemy.sql.expression import or_
 
from tg import request, response
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from webob.exc import HTTPFound, HTTPNotFound, HTTPForbidden
 
from webob.exc import HTTPForbidden, HTTPFound, HTTPNotFound
 

	
 
from kallithea.config.routing import url
 
from kallithea.lib import helpers as h
 
from kallithea.lib.auth import LoginRequired
 
from kallithea.lib.base import BaseController, jsonify, render
 
from kallithea.lib.page import Page
 
from kallithea.lib.utils2 import safe_int, safe_unicode, time_to_datetime
 
from kallithea.lib.vcs.exceptions import NodeNotChangedError, VCSError
 
from kallithea.model.db import Gist
 
from kallithea.model.forms import GistForm
 
from kallithea.model.gist import GistModel
 
from kallithea.model.meta import Session
 
from kallithea.model.db import Gist, User
 
from kallithea.lib import helpers as h
 
from kallithea.lib.base import BaseController, render, jsonify
 
from kallithea.lib.auth import LoginRequired
 
from kallithea.lib.utils2 import safe_int, safe_unicode, time_to_datetime
 
from kallithea.lib.page import Page
 
from sqlalchemy.sql.expression import or_
 
from kallithea.lib.vcs.exceptions import VCSError, NodeNotChangedError
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 
@@ -118,6 +119,7 @@ class GistsController(BaseController):
 
            gist = GistModel().create(
 
                description=form_result['description'],
 
                owner=request.authuser.user_id,
 
                ip_addr=request.ip_addr,
 
                gist_mapping=nodes,
 
                gist_type=gist_type,
 
                lifetime=form_result['lifetime']
 
@@ -215,7 +217,8 @@ class GistsController(BaseController):
 
                GistModel().update(
 
                    gist=c.gist,
 
                    description=rpost['description'],
 
                    owner=c.gist.owner,
 
                    owner=c.gist.owner, # FIXME: request.authuser.user_id ?
 
                    ip_addr=request.ip_addr,
 
                    gist_mapping=nodes,
 
                    gist_type=c.gist.gist_type,
 
                    lifetime=rpost['lifetime']
kallithea/controllers/admin/my_account.py
Show inline comments
 
@@ -27,26 +27,28 @@ Original author and date, and relevant c
 

	
 
import logging
 
import traceback
 

	
 
import formencode
 

	
 
from sqlalchemy import func
 
from formencode import htmlfill
 
from tg import request, tmpl_context as c
 
from tg import request
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from webob.exc import HTTPFound
 

	
 
from kallithea.config.routing import url
 
from kallithea.lib import auth_modules
 
from kallithea.lib import helpers as h
 
from kallithea.lib import auth_modules
 
from kallithea.lib.auth import LoginRequired, AuthUser
 
from kallithea.lib.base import BaseController, render
 
from kallithea.lib.auth import AuthUser, LoginRequired
 
from kallithea.lib.base import BaseController, IfSshEnabled, render
 
from kallithea.lib.utils2 import generate_api_key, safe_int
 
from kallithea.model.db import Repository, UserEmailMap, User, UserFollowing
 
from kallithea.model.forms import UserForm, PasswordChangeForm
 
from kallithea.model.api_key import ApiKeyModel
 
from kallithea.model.db import Repository, User, UserEmailMap, UserFollowing
 
from kallithea.model.forms import PasswordChangeForm, UserForm
 
from kallithea.model.meta import Session
 
from kallithea.model.repo import RepoModel
 
from kallithea.model.ssh_key import SshKeyModel, SshKeyModelException
 
from kallithea.model.user import UserModel
 
from kallithea.model.repo import RepoModel
 
from kallithea.model.api_key import ApiKeyModel
 
from kallithea.model.meta import Session
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 
@@ -259,3 +261,36 @@ class MyAccountController(BaseController
 
            h.flash(_("API key successfully deleted"), category='success')
 

	
 
        raise HTTPFound(location=url('my_account_api_keys'))
 

	
 
    @IfSshEnabled
 
    def my_account_ssh_keys(self):
 
        c.active = 'ssh_keys'
 
        self.__load_data()
 
        c.user_ssh_keys = SshKeyModel().get_ssh_keys(request.authuser.user_id)
 
        return render('admin/my_account/my_account.html')
 

	
 
    @IfSshEnabled
 
    def my_account_ssh_keys_add(self):
 
        description = request.POST.get('description')
 
        public_key = request.POST.get('public_key')
 
        try:
 
            new_ssh_key = SshKeyModel().create(request.authuser.user_id,
 
                                               description, public_key)
 
            Session().commit()
 
            SshKeyModel().write_authorized_keys()
 
            h.flash(_("SSH key %s successfully added") % new_ssh_key.fingerprint, category='success')
 
        except SshKeyModelException as errors:
 
            h.flash(errors.message, category='error')
 
        raise HTTPFound(location=url('my_account_ssh_keys'))
 

	
 
    @IfSshEnabled
 
    def my_account_ssh_keys_delete(self):
 
        public_key = request.POST.get('del_public_key')
 
        try:
 
            SshKeyModel().delete(public_key, request.authuser.user_id)
 
            Session().commit()
 
            SshKeyModel().write_authorized_keys()
 
            h.flash(_("SSH key successfully deleted"), category='success')
 
        except SshKeyModelException as errors:
 
            h.flash(errors.message, category='error')
 
        raise HTTPFound(location=url('my_account_ssh_keys'))
kallithea/controllers/admin/permissions.py
Show inline comments
 
@@ -28,21 +28,23 @@ Original author and date, and relevant c
 

	
 
import logging
 
import traceback
 

	
 
import formencode
 
from formencode import htmlfill
 

	
 
from tg import request, tmpl_context as c
 
from tg import request
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from webob.exc import HTTPFound
 

	
 
from kallithea.config.routing import url
 
from kallithea.lib import helpers as h
 
from kallithea.lib.auth import LoginRequired, HasPermissionAnyDecorator, AuthUser
 
from kallithea.lib.auth import AuthUser, HasPermissionAnyDecorator, LoginRequired
 
from kallithea.lib.base import BaseController, render
 
from kallithea.model.db import User, UserIpMap
 
from kallithea.model.forms import DefaultPermissionsForm
 
from kallithea.model.meta import Session
 
from kallithea.model.permission import PermissionModel
 
from kallithea.model.db import User, UserIpMap
 
from kallithea.model.meta import Session
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 
@@ -155,7 +157,7 @@ class PermissionsController(BaseControll
 
            if p.permission.permission_name.startswith('usergroup.'):
 
                defaults['default_user_group_perm'] = p.permission.permission_name
 

	
 
            if p.permission.permission_name.startswith('hg.create.write_on_repogroup'):
 
            if p.permission.permission_name.startswith('hg.create.write_on_repogroup.'):
 
                defaults['create_on_write'] = p.permission.permission_name
 

	
 
            elif p.permission.permission_name.startswith('hg.create.'):
kallithea/controllers/admin/repo_groups.py
Show inline comments
 
@@ -25,32 +25,30 @@ Original author and date, and relevant c
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 

	
 
import itertools
 
import logging
 
import traceback
 

	
 
import formencode
 
import itertools
 

	
 
from formencode import htmlfill
 

	
 
from tg import request, tmpl_context as c, app_globals
 
from tg.i18n import ugettext as _, ungettext
 
from webob.exc import HTTPFound, HTTPForbidden, HTTPNotFound, HTTPInternalServerError
 
from tg import app_globals, request
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from tg.i18n import ungettext
 
from webob.exc import HTTPForbidden, HTTPFound, HTTPInternalServerError, HTTPNotFound
 

	
 
import kallithea
 
from kallithea.config.routing import url
 
from kallithea.lib import helpers as h
 
from kallithea.lib.auth import LoginRequired, \
 
    HasRepoGroupPermissionLevelDecorator, HasRepoGroupPermissionLevel, \
 
    HasPermissionAny
 
from kallithea.lib.auth import HasPermissionAny, HasRepoGroupPermissionLevel, HasRepoGroupPermissionLevelDecorator, LoginRequired
 
from kallithea.lib.base import BaseController, render
 
from kallithea.lib.utils2 import safe_int
 
from kallithea.model.db import RepoGroup, Repository
 
from kallithea.model.scm import RepoGroupList, AvailableRepoGroupChoices
 
from kallithea.model.repo_group import RepoGroupModel
 
from kallithea.model.forms import RepoGroupForm, RepoGroupPermsForm
 
from kallithea.model.meta import Session
 
from kallithea.model.repo import RepoModel
 
from kallithea.lib.utils2 import safe_int
 
from sqlalchemy.sql.expression import func
 
from kallithea.model.repo_group import RepoGroupModel
 
from kallithea.model.scm import AvailableRepoGroupChoices, RepoGroupList
 

	
 

	
 
log = logging.getLogger(__name__)
kallithea/controllers/admin/repos.py
Show inline comments
 
@@ -27,28 +27,28 @@ Original author and date, and relevant c
 

	
 
import logging
 
import traceback
 

	
 
import formencode
 
from formencode import htmlfill
 
from tg import request, tmpl_context as c
 
from tg import request
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from sqlalchemy.sql.expression import func
 
from webob.exc import HTTPFound, HTTPInternalServerError, HTTPForbidden, HTTPNotFound
 
from webob.exc import HTTPForbidden, HTTPFound, HTTPInternalServerError, HTTPNotFound
 

	
 
from kallithea.config.routing import url
 
from kallithea.lib import helpers as h
 
from kallithea.lib.auth import LoginRequired, \
 
    HasRepoPermissionLevelDecorator, NotAnonymous, HasPermissionAny
 
from kallithea.lib.base import BaseRepoController, render, jsonify
 
from kallithea.lib.auth import HasPermissionAny, HasRepoPermissionLevelDecorator, LoginRequired, NotAnonymous
 
from kallithea.lib.base import BaseRepoController, jsonify, render
 
from kallithea.lib.exceptions import AttachedForksError
 
from kallithea.lib.utils import action_logger
 
from kallithea.lib.utils2 import safe_int
 
from kallithea.lib.vcs import RepositoryError
 
from kallithea.model.db import RepoGroup, Repository, RepositoryField, Setting, User, UserFollowing
 
from kallithea.model.forms import RepoFieldForm, RepoForm, RepoPermsForm
 
from kallithea.model.meta import Session
 
from kallithea.model.db import User, Repository, UserFollowing, RepoGroup, \
 
    Setting, RepositoryField
 
from kallithea.model.forms import RepoForm, RepoFieldForm, RepoPermsForm
 
from kallithea.model.scm import ScmModel, AvailableRepoGroupChoices, RepoList
 
from kallithea.model.repo import RepoModel
 
from kallithea.lib.exceptions import AttachedForksError
 
from kallithea.lib.utils2 import safe_int
 
from kallithea.model.scm import AvailableRepoGroupChoices, RepoList, ScmModel
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 
@@ -94,15 +94,14 @@ class ReposController(BaseRepoController
 

	
 
        defaults = RepoModel()._get_defaults(c.repo_name)
 
        defaults['clone_uri'] = c.repo_info.clone_uri_hidden # don't show password
 
        defaults['permanent_url'] = c.repo_info.clone_url(clone_uri_tmpl=c.clone_uri_tmpl, with_id=True)
 

	
 
        return defaults
 

	
 
    def index(self, format='html'):
 
        _list = Repository.query(sorted=True).all()
 

	
 
        c.repos_list = RepoList(_list, perm_level='admin')
 
        repos_list = RepoList(Repository.query(sorted=True).all(), perm_level='admin')
 
        # the repo list will be filtered to only show repos where the user has read permissions
 
        repos_data = RepoModel().get_repos_as_dict(c.repos_list, admin=True)
 
        repos_data = RepoModel().get_repos_as_dict(repos_list, admin=True)
 
        # data used to render the grid
 
        c.data = repos_data
 

	
 
@@ -339,7 +338,8 @@ class ReposController(BaseRepoController
 
                obj_id = safe_int(request.POST.get('user_id'))
 
            elif obj_type == 'user_group':
 
                obj_id = safe_int(request.POST.get('user_group_id'))
 
            else: assert False
 
            else:
 
                assert False
 

	
 
            if obj_type == 'user':
 
                RepoModel().revoke_user_permission(repo=repo_name, user=obj_id)
 
@@ -347,7 +347,8 @@ class ReposController(BaseRepoController
 
                RepoModel().revoke_user_group_permission(
 
                    repo=repo_name, group_name=obj_id
 
                )
 
            else: assert False
 
            else:
 
                assert False
 
            # TODO: implement this
 
            #action_logger(request.authuser, 'admin_revoked_repo_permissions',
 
            #              repo_name, request.ip_addr)
 
@@ -415,7 +416,8 @@ class ReposController(BaseRepoController
 
        c.repos_list = [(None, _('-- Not a fork --'))]
 
        c.repos_list += [(x.repo_id, x.repo_name)
 
                         for x in read_access_repos
 
                         if x.repo_id != c.repo_info.repo_id]
 
                         if x.repo_id != c.repo_info.repo_id
 
                         and x.repo_type == c.repo_info.repo_type]
 

	
 
        defaults = {
 
            'id_fork_of': c.repo_info.fork_id if c.repo_info.fork_id else ''
 
@@ -478,46 +480,6 @@ class ReposController(BaseRepoController
 
        raise HTTPFound(location=url('edit_repo_advanced', repo_name=repo_name))
 

	
 
    @HasRepoPermissionLevelDecorator('admin')
 
    def edit_advanced_locking(self, repo_name):
 
        """
 
        Unlock repository when it is locked !
 

	
 
        :param repo_name:
 
        """
 
        try:
 
            repo = Repository.get_by_repo_name(repo_name)
 
            if request.POST.get('set_lock'):
 
                Repository.lock(repo, request.authuser.user_id)
 
                h.flash(_('Repository has been locked'), category='success')
 
            elif request.POST.get('set_unlock'):
 
                Repository.unlock(repo)
 
                h.flash(_('Repository has been unlocked'), category='success')
 
        except Exception as e:
 
            log.error(traceback.format_exc())
 
            h.flash(_('An error occurred during unlocking'),
 
                    category='error')
 
        raise HTTPFound(location=url('edit_repo_advanced', repo_name=repo_name))
 

	
 
    @HasRepoPermissionLevelDecorator('write')
 
    def toggle_locking(self, repo_name):
 
        try:
 
            repo = Repository.get_by_repo_name(repo_name)
 

	
 
            if repo.enable_locking:
 
                if repo.locked[0]:
 
                    Repository.unlock(repo)
 
                    h.flash(_('Repository has been unlocked'), category='success')
 
                else:
 
                    Repository.lock(repo, request.authuser.user_id)
 
                    h.flash(_('Repository has been locked'), category='success')
 

	
 
        except Exception as e:
 
            log.error(traceback.format_exc())
 
            h.flash(_('An error occurred during unlocking'),
 
                    category='error')
 
        raise HTTPFound(location=url('summary_home', repo_name=repo_name))
 

	
 
    @HasRepoPermissionLevelDecorator('admin')
 
    def edit_caches(self, repo_name):
 
        c.repo_info = self._load_repo()
 
        c.active = 'caches'
 
@@ -541,7 +503,7 @@ class ReposController(BaseRepoController
 
        c.active = 'remote'
 
        if request.POST:
 
            try:
 
                ScmModel().pull_changes(repo_name, request.authuser.username)
 
                ScmModel().pull_changes(repo_name, request.authuser.username, request.ip_addr)
 
                h.flash(_('Pulled from remote location'), category='success')
 
            except Exception as e:
 
                log.error(traceback.format_exc())
kallithea/controllers/admin/settings.py
Show inline comments
 
@@ -27,28 +27,30 @@ Original author and date, and relevant c
 

	
 
import logging
 
import traceback
 

	
 
import formencode
 

	
 
from formencode import htmlfill
 
from tg import request, tmpl_context as c, config
 
from tg import config, request
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from webob.exc import HTTPFound
 

	
 
from kallithea.config.routing import url
 
from kallithea.lib import helpers as h
 
from kallithea.lib.auth import LoginRequired, HasPermissionAnyDecorator
 
from kallithea.lib.auth import HasPermissionAnyDecorator, LoginRequired
 
from kallithea.lib.base import BaseController, render
 
from kallithea.lib.celerylib import tasks
 
from kallithea.lib.exceptions import HgsubversionImportError
 
from kallithea.lib.utils import repo2db_mapper, set_app_settings
 
from kallithea.lib.utils2 import safe_unicode
 
from kallithea.lib.vcs import VCSError
 
from kallithea.model.db import Ui, Repository, Setting
 
from kallithea.model.forms import ApplicationSettingsForm, \
 
    ApplicationUiSettingsForm, ApplicationVisualisationForm
 
from kallithea.model.db import Repository, Setting, Ui
 
from kallithea.model.forms import ApplicationSettingsForm, ApplicationUiSettingsForm, ApplicationVisualisationForm
 
from kallithea.model.meta import Session
 
from kallithea.model.notification import EmailNotificationModel
 
from kallithea.model.scm import ScmModel
 
from kallithea.model.notification import EmailNotificationModel
 
from kallithea.model.meta import Session
 
from kallithea.lib.utils2 import str2bool, safe_unicode
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
@@ -109,12 +111,6 @@ class SettingsController(BaseController)
 
                sett = Ui.get_by_key('hooks', Ui.HOOK_REPO_SIZE)
 
                sett.ui_active = form_result['hooks_changegroup_repo_size']
 

	
 
                sett = Ui.get_by_key('hooks', Ui.HOOK_PUSH_LOG)
 
                sett.ui_active = form_result['hooks_changegroup_push_logger']
 

	
 
                sett = Ui.get_by_key('hooks', Ui.HOOK_PULL_LOG)
 
                sett.ui_active = form_result['hooks_outgoing_pull_logger']
 

	
 
                ## EXTENSIONS
 
                sett = Ui.get_or_create('extensions', 'largefiles')
 
                sett.ui_active = form_result['extensions_largefiles']
 
@@ -277,6 +273,7 @@ class SettingsController(BaseController)
 
                    ('use_gravatar', 'use_gravatar', 'bool'),
 
                    ('gravatar_url', 'gravatar_url', 'unicode'),
 
                    ('clone_uri_tmpl', 'clone_uri_tmpl', 'unicode'),
 
                    ('clone_ssh_tmpl', 'clone_ssh_tmpl', 'unicode'),
 
                ]
 
                for setting, form_key, type_ in settings:
 
                    Setting.create_or_update(setting, form_result[form_key], type_)
 
@@ -425,7 +422,6 @@ class SettingsController(BaseController)
 

	
 
        import kallithea
 
        c.ini = kallithea.CONFIG
 
        c.update_url = defaults.get('update_url')
 
        server_info = Setting.get_server_info()
 
        for key, val in server_info.iteritems():
 
            setattr(c, key, val)
 
@@ -435,46 +431,3 @@ class SettingsController(BaseController)
 
            defaults=defaults,
 
            encoding="UTF-8",
 
            force_defaults=False)
 

	
 
    @HasPermissionAnyDecorator('hg.admin')
 
    def settings_system_update(self):
 
        import json
 
        import urllib2
 
        from kallithea.lib.verlib import NormalizedVersion
 
        from kallithea import __version__
 

	
 
        defaults = Setting.get_app_settings()
 
        defaults.update(self._get_hg_ui_settings())
 
        _update_url = defaults.get('update_url', '')
 
        _update_url = "" # FIXME: disabled
 

	
 
        _err = lambda s: '<div class="alert alert-danger">%s</div>' % (s)
 
        try:
 
            import kallithea
 
            ver = kallithea.__version__
 
            log.debug('Checking for upgrade on `%s` server', _update_url)
 
            opener = urllib2.build_opener()
 
            opener.addheaders = [('User-agent', 'Kallithea-SCM/%s' % ver)]
 
            response = opener.open(_update_url)
 
            response_data = response.read()
 
            data = json.loads(response_data)
 
        except urllib2.URLError as e:
 
            log.error(traceback.format_exc())
 
            return _err('Failed to contact upgrade server: %r' % e)
 
        except ValueError as e:
 
            log.error(traceback.format_exc())
 
            return _err('Bad data sent from update server')
 

	
 
        latest = data['versions'][0]
 

	
 
        c.update_url = _update_url
 
        c.latest_data = latest
 
        c.latest_ver = latest['version']
 
        c.cur_ver = __version__
 
        c.should_upgrade = False
 

	
 
        if NormalizedVersion(c.latest_ver) > NormalizedVersion(c.cur_ver):
 
            c.should_upgrade = True
 
        c.important_notices = latest['general']
 

	
 
        return render('admin/settings/settings_system_update.html'),
kallithea/controllers/admin/user_groups.py
Show inline comments
 
@@ -27,35 +27,30 @@ Original author and date, and relevant c
 

	
 
import logging
 
import traceback
 

	
 
import formencode
 

	
 
from formencode import htmlfill
 
from tg import request, tmpl_context as c, config, app_globals
 
from tg.i18n import ugettext as _
 
from webob.exc import HTTPFound
 

	
 
from sqlalchemy.orm import joinedload
 
from sqlalchemy.sql.expression import func
 
from webob.exc import HTTPInternalServerError
 
from tg import app_globals, config, request
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from webob.exc import HTTPFound, HTTPInternalServerError
 

	
 
import kallithea
 
from kallithea.config.routing import url
 
from kallithea.lib import helpers as h
 
from kallithea.lib.exceptions import UserGroupsAssignedException, \
 
    RepoGroupAssignmentError
 
from kallithea.lib.utils2 import safe_unicode, safe_int
 
from kallithea.lib.auth import LoginRequired, \
 
    HasUserGroupPermissionLevelDecorator, HasPermissionAnyDecorator
 
from kallithea.lib.auth import HasPermissionAnyDecorator, HasUserGroupPermissionLevelDecorator, LoginRequired
 
from kallithea.lib.base import BaseController, render
 
from kallithea.lib.exceptions import RepoGroupAssignmentError, UserGroupsAssignedException
 
from kallithea.lib.utils import action_logger
 
from kallithea.lib.utils2 import safe_int, safe_unicode
 
from kallithea.model.db import User, UserGroup, UserGroupRepoGroupToPerm, UserGroupRepoToPerm, UserGroupToPerm
 
from kallithea.model.forms import CustomDefaultPermissionsForm, UserGroupForm, UserGroupPermsForm
 
from kallithea.model.meta import Session
 
from kallithea.model.scm import UserGroupList
 
from kallithea.model.user_group import UserGroupModel
 
from kallithea.model.repo import RepoModel
 
from kallithea.model.db import User, UserGroup, UserGroupToPerm, \
 
    UserGroupRepoToPerm, UserGroupRepoGroupToPerm
 
from kallithea.model.forms import UserGroupForm, UserGroupPermsForm, \
 
    CustomDefaultPermissionsForm
 
from kallithea.model.meta import Session
 
from kallithea.lib.utils import action_logger
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 
@@ -369,8 +364,6 @@ class UserGroupsController(BaseControlle
 
            form = CustomDefaultPermissionsForm()()
 
            form_result = form.to_python(request.POST)
 

	
 
            inherit_perms = form_result['inherit_default_permissions']
 
            user_group.inherit_default_permissions = inherit_perms
 
            usergroup_model = UserGroupModel()
 

	
 
            defs = UserGroupToPerm.query() \
kallithea/controllers/admin/users.py
Show inline comments
 
@@ -27,31 +27,31 @@ Original author and date, and relevant c
 

	
 
import logging
 
import traceback
 

	
 
import formencode
 

	
 
from formencode import htmlfill
 
from tg import request, tmpl_context as c, config, app_globals
 
from sqlalchemy.sql.expression import func
 
from tg import app_globals, config, request
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from sqlalchemy.sql.expression import func
 
from webob.exc import HTTPFound, HTTPNotFound
 

	
 
import kallithea
 
from kallithea.config.routing import url
 
from kallithea.lib.exceptions import DefaultUserException, \
 
    UserOwnsReposException, UserCreationError
 
from kallithea.lib import auth_modules
 
from kallithea.lib import helpers as h
 
from kallithea.lib.auth import LoginRequired, HasPermissionAnyDecorator, \
 
    AuthUser
 
from kallithea.lib import auth_modules
 
from kallithea.lib.base import BaseController, render
 
from kallithea.lib.auth import AuthUser, HasPermissionAnyDecorator, LoginRequired
 
from kallithea.lib.base import BaseController, IfSshEnabled, render
 
from kallithea.lib.exceptions import DefaultUserException, UserCreationError, UserOwnsReposException
 
from kallithea.lib.utils import action_logger
 
from kallithea.lib.utils2 import datetime_to_time, generate_api_key, safe_int
 
from kallithea.model.api_key import ApiKeyModel
 

	
 
from kallithea.model.db import User, UserEmailMap, UserIpMap, UserToPerm
 
from kallithea.model.forms import UserForm, CustomDefaultPermissionsForm
 
from kallithea.model.forms import CustomDefaultPermissionsForm, UserForm
 
from kallithea.model.meta import Session
 
from kallithea.model.ssh_key import SshKeyModel, SshKeyModelException
 
from kallithea.model.user import UserModel
 
from kallithea.model.meta import Session
 
from kallithea.lib.utils import action_logger
 
from kallithea.lib.utils2 import datetime_to_time, safe_int, generate_api_key
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 
@@ -315,8 +315,6 @@ class UsersController(BaseController):
 
            form = CustomDefaultPermissionsForm()()
 
            form_result = form.to_python(request.POST)
 

	
 
            inherit_perms = form_result['inherit_default_permissions']
 
            user.inherit_default_permissions = inherit_perms
 
            user_model = UserModel()
 

	
 
            defs = UserToPerm.query() \
 
@@ -391,7 +389,6 @@ class UsersController(BaseController):
 
        c.user_ip_map = UserIpMap.query() \
 
            .filter(UserIpMap.user == c.user).all()
 

	
 
        c.inherit_default_ips = c.user.inherit_default_permissions
 
        c.default_user_ip_map = UserIpMap.query() \
 
            .filter(UserIpMap.user == User.get_default_user()).all()
 

	
 
@@ -432,3 +429,45 @@ class UsersController(BaseController):
 
        if 'default_user' in request.POST:
 
            raise HTTPFound(location=url('admin_permissions_ips'))
 
        raise HTTPFound(location=url('edit_user_ips', id=id))
 

	
 
    @IfSshEnabled
 
    def edit_ssh_keys(self, id):
 
        c.user = self._get_user_or_raise_if_default(id)
 
        c.active = 'ssh_keys'
 
        c.user_ssh_keys = SshKeyModel().get_ssh_keys(c.user.user_id)
 
        defaults = c.user.get_dict()
 
        return htmlfill.render(
 
            render('admin/users/user_edit.html'),
 
            defaults=defaults,
 
            encoding="UTF-8",
 
            force_defaults=False)
 

	
 
    @IfSshEnabled
 
    def ssh_keys_add(self, id):
 
        c.user = self._get_user_or_raise_if_default(id)
 

	
 
        description = request.POST.get('description')
 
        public_key = request.POST.get('public_key')
 
        try:
 
            new_ssh_key = SshKeyModel().create(c.user.user_id,
 
                                               description, public_key)
 
            Session().commit()
 
            SshKeyModel().write_authorized_keys()
 
            h.flash(_("SSH key %s successfully added") % new_ssh_key.fingerprint, category='success')
 
        except SshKeyModelException as errors:
 
            h.flash(errors.message, category='error')
 
        raise HTTPFound(location=url('edit_user_ssh_keys', id=c.user.user_id))
 

	
 
    @IfSshEnabled
 
    def ssh_keys_delete(self, id):
 
        c.user = self._get_user_or_raise_if_default(id)
 

	
 
        public_key = request.POST.get('del_public_key')
 
        try:
 
            SshKeyModel().delete(public_key, c.user.user_id)
 
            Session().commit()
 
            SshKeyModel().write_authorized_keys()
 
            h.flash(_("SSH key successfully deleted"), category='success')
 
        except SshKeyModelException as errors:
 
            h.flash(errors.message, category='error')
 
        raise HTTPFound(location=url('edit_user_ssh_keys', id=c.user.user_id))
kallithea/controllers/api/__init__.py
Show inline comments
 
@@ -26,22 +26,22 @@ Original author and date, and relevant c
 
"""
 

	
 
import inspect
 
import itertools
 
import logging
 
import types
 
import traceback
 
import time
 
import itertools
 

	
 
from tg import Response, response, request, TGController
 
import traceback
 
import types
 

	
 
from webob.exc import HTTPError, HTTPException, WSGIHTTPException
 
from tg import Response, TGController, request, response
 
from webob.exc import HTTPError, HTTPException
 

	
 
from kallithea.lib.auth import AuthUser
 
from kallithea.lib.base import _get_access_path
 
from kallithea.lib.base import _get_ip_addr as _get_ip
 
from kallithea.lib.compat import json
 
from kallithea.lib.utils2 import safe_str, safe_unicode
 
from kallithea.model.db import User
 
from kallithea.model import meta
 
from kallithea.lib.compat import json
 
from kallithea.lib.auth import AuthUser
 
from kallithea.lib.base import _get_ip_addr as _get_ip, _get_access_path
 
from kallithea.lib.utils2 import safe_unicode, safe_str
 

	
 

	
 
log = logging.getLogger('JSONRPC')
 

	
 
@@ -103,7 +103,7 @@ class JSONRPCController(TGController):
 

	
 
        environ = state.request.environ
 
        start = time.time()
 
        ip_addr = request.ip_addr = self._get_ip_addr(environ)
 
        ip_addr = self._get_ip_addr(environ)
 
        self._req_id = None
 
        if 'CONTENT_LENGTH' not in environ:
 
            log.debug("No Content-Length")
 
@@ -146,21 +146,17 @@ class JSONRPCController(TGController):
 
        # check if we can find this session using api_key
 
        try:
 
            u = User.get_by_api_key(self._req_api_key)
 
            if u is None:
 
            auth_user = AuthUser.make(dbuser=u, ip_addr=ip_addr)
 
            if auth_user is None:
 
                raise JSONRPCErrorResponse(retid=self._req_id,
 
                                           message='Invalid API key')
 

	
 
            auth_u = AuthUser(dbuser=u)
 
            if not AuthUser.check_ip_allowed(auth_u, ip_addr):
 
                raise JSONRPCErrorResponse(retid=self._req_id,
 
                                           message='request from IP:%s not allowed' % (ip_addr,))
 
            else:
 
                log.info('Access for IP:%s allowed', ip_addr)
 

	
 
        except Exception as e:
 
            raise JSONRPCErrorResponse(retid=self._req_id,
 
                                       message='Invalid API key')
 

	
 
        request.authuser = auth_user
 
        request.ip_addr = ip_addr
 

	
 
        self._error = None
 
        try:
 
            self._func = self._find_method()
 
@@ -179,11 +175,6 @@ class JSONRPCController(TGController):
 
        func_kwargs = dict(itertools.izip_longest(reversed(arglist), reversed(defaults),
 
                                                  fillvalue=default_empty))
 

	
 
        # this is little trick to inject logged in user for
 
        # perms decorators to work they expect the controller class to have
 
        # authuser attribute set
 
        request.authuser = auth_u
 

	
 
        # This attribute will need to be first param of a method that uses
 
        # api_key, which is translated to instance of user at that name
 
        USER_SESSION_ATTR = 'apiuser'
 
@@ -205,11 +196,11 @@ class JSONRPCController(TGController):
 

	
 
        extra = set(self._request_params).difference(func_kwargs)
 
        if extra:
 
                raise JSONRPCErrorResponse(
 
                    retid=self._req_id,
 
                    message='Unknown %s arg in JSON DATA' %
 
                            ', '.join('`%s`' % arg for arg in extra),
 
                )
 
            raise JSONRPCErrorResponse(
 
                retid=self._req_id,
 
                message='Unknown %s arg in JSON DATA' %
 
                        ', '.join('`%s`' % arg for arg in extra),
 
            )
 

	
 
        self._rpc_args = {}
 
        self._rpc_args.update(self._request_params)
kallithea/controllers/api/api.py
Show inline comments
 
@@ -25,42 +25,32 @@ Original author and date, and relevant c
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 

	
 
import time
 
import logging
 
import traceback
 
import logging
 

	
 
from datetime import datetime
 
from sqlalchemy import or_
 

	
 
from tg import request
 

	
 
from kallithea.controllers.api import JSONRPCController, JSONRPCError
 
from kallithea.lib.auth import (
 
    PasswordGenerator, AuthUser, HasPermissionAnyDecorator,
 
    HasPermissionAnyDecorator, HasPermissionAny, HasRepoPermissionLevel,
 
    HasRepoGroupPermissionLevel, HasUserGroupPermissionLevel)
 
from kallithea.lib.utils import map_groups, repo2db_mapper
 
from kallithea.lib.utils2 import (
 
    str2bool, time_to_datetime, safe_int, Optional, OAttr)
 
    AuthUser, HasPermissionAny, HasPermissionAnyDecorator, HasRepoGroupPermissionLevel, HasRepoPermissionLevel, HasUserGroupPermissionLevel)
 
from kallithea.lib.exceptions import DefaultUserException, UserGroupsAssignedException
 
from kallithea.lib.utils import action_logger, repo2db_mapper
 
from kallithea.lib.utils2 import OAttr, Optional
 
from kallithea.lib.vcs.backends.base import EmptyChangeset
 
from kallithea.lib.vcs.exceptions import EmptyRepositoryError
 
from kallithea.model.changeset_status import ChangesetStatusModel
 
from kallithea.model.comment import ChangesetCommentsModel
 
from kallithea.model.db import ChangesetStatus, Gist, Permission, PullRequest, RepoGroup, Repository, Setting, User, UserGroup, UserIpMap
 
from kallithea.model.gist import GistModel
 
from kallithea.model.meta import Session
 
from kallithea.model.pull_request import PullRequestModel
 
from kallithea.model.repo import RepoModel
 
from kallithea.model.repo_group import RepoGroupModel
 
from kallithea.model.scm import ScmModel, UserGroupList
 
from kallithea.model.repo import RepoModel
 
from kallithea.model.user import UserModel
 
from kallithea.model.user_group import UserGroupModel
 
from kallithea.model.gist import GistModel
 
from kallithea.model.changeset_status import ChangesetStatusModel
 
from kallithea.model.comment import ChangesetCommentsModel
 
from kallithea.model.pull_request import PullRequestModel
 
from kallithea.model.db import (
 
    Repository, Setting, UserIpMap, Permission, User, Gist,
 
    RepoGroup, UserGroup, PullRequest, ChangesetStatus)
 
from kallithea.lib.compat import json
 
from kallithea.lib.exceptions import (
 
    DefaultUserException, UserGroupsAssignedException)
 
from kallithea.lib.vcs.exceptions import ChangesetDoesNotExistError, EmptyRepositoryError
 
from kallithea.lib.vcs.backends.base import EmptyChangeset
 
from kallithea.lib.utils import action_logger
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 
@@ -206,6 +196,7 @@ class ApiController(JSONRPCController):
 
        try:
 
            ScmModel().pull_changes(repo.repo_name,
 
                                    request.authuser.username,
 
                                    request.ip_addr,
 
                                    clone_uri=Optional.extract(clone_uri))
 
            return dict(
 
                msg='Pulled from `%s`' % repo.repo_name,
 
@@ -303,168 +294,6 @@ class ApiController(JSONRPCController):
 
                'Error occurred during cache invalidation action'
 
            )
 

	
 
    # permission check inside
 
    def lock(self, repoid, locked=Optional(None),
 
             userid=Optional(OAttr('apiuser'))):
 
        """
 
        Set locking state on given repository by given user. If userid param
 
        is skipped, then it is set to id of user who is calling this method.
 
        If locked param is skipped then function shows current lock state of
 
        given repo. This command can be executed only using api_key belonging
 
        to user with admin rights or regular user that have admin or write
 
        access to repository.
 

	
 
        :param repoid: repository name or repository id
 
        :type repoid: str or int
 
        :param locked: lock state to be set
 
        :type locked: Optional(bool)
 
        :param userid: set lock as user
 
        :type userid: Optional(str or int)
 

	
 
        OUTPUT::
 

	
 
          id : <id_given_in_input>
 
          result : {
 
            'repo': '<reponame>',
 
            'locked': <bool: lock state>,
 
            'locked_since': <int: lock timestamp>,
 
            'locked_by': <username of person who made the lock>,
 
            'lock_state_changed': <bool: True if lock state has been changed in this request>,
 
            'msg': 'Repo `<reponame>` locked by `<username>` on <timestamp>.'
 
            or
 
            'msg': 'Repo `<repository name>` not locked.'
 
            or
 
            'msg': 'User `<user name>` set lock state for repo `<repository name>` to `<new lock state>`'
 
          }
 
          error :  null
 

	
 
        ERROR OUTPUT::
 

	
 
          id : <id_given_in_input>
 
          result : null
 
          error :  {
 
            'Error occurred locking repository `<reponame>`
 
          }
 

	
 
        """
 
        repo = get_repo_or_error(repoid)
 
        if HasPermissionAny('hg.admin')():
 
            pass
 
        elif HasRepoPermissionLevel('write')(repo.repo_name):
 
            # make sure normal user does not pass someone else userid,
 
            # he is not allowed to do that
 
            if not isinstance(userid, Optional) and userid != request.authuser.user_id:
 
                raise JSONRPCError(
 
                    'userid is not the same as your user'
 
                )
 
        else:
 
            raise JSONRPCError('repository `%s` does not exist' % (repoid,))
 

	
 
        if isinstance(userid, Optional):
 
            userid = request.authuser.user_id
 

	
 
        user = get_user_or_error(userid)
 

	
 
        if isinstance(locked, Optional):
 
            lockobj = Repository.getlock(repo)
 

	
 
            if lockobj[0] is None:
 
                _d = {
 
                    'repo': repo.repo_name,
 
                    'locked': False,
 
                    'locked_since': None,
 
                    'locked_by': None,
 
                    'lock_state_changed': False,
 
                    'msg': 'Repo `%s` not locked.' % repo.repo_name
 
                }
 
                return _d
 
            else:
 
                userid, time_ = lockobj
 
                lock_user = get_user_or_error(userid)
 
                _d = {
 
                    'repo': repo.repo_name,
 
                    'locked': True,
 
                    'locked_since': time_,
 
                    'locked_by': lock_user.username,
 
                    'lock_state_changed': False,
 
                    'msg': ('Repo `%s` locked by `%s` on `%s`.'
 
                            % (repo.repo_name, lock_user.username,
 
                               json.dumps(time_to_datetime(time_))))
 
                }
 
                return _d
 

	
 
        # force locked state through a flag
 
        else:
 
            locked = str2bool(locked)
 
            try:
 
                if locked:
 
                    lock_time = time.time()
 
                    Repository.lock(repo, user.user_id, lock_time)
 
                else:
 
                    lock_time = None
 
                    Repository.unlock(repo)
 
                _d = {
 
                    'repo': repo.repo_name,
 
                    'locked': locked,
 
                    'locked_since': lock_time,
 
                    'locked_by': user.username,
 
                    'lock_state_changed': True,
 
                    'msg': ('User `%s` set lock state for repo `%s` to `%s`'
 
                            % (user.username, repo.repo_name, locked))
 
                }
 
                return _d
 
            except Exception:
 
                log.error(traceback.format_exc())
 
                raise JSONRPCError(
 
                    'Error occurred locking repository `%s`' % repo.repo_name
 
                )
 

	
 
    def get_locks(self, userid=Optional(OAttr('apiuser'))):
 
        """
 
        Get all repositories with locks for given userid, if
 
        this command is run by non-admin account userid is set to user
 
        who is calling this method, thus returning locks for himself.
 

	
 
        :param userid: User to get locks for
 
        :type userid: Optional(str or int)
 

	
 
        OUTPUT::
 

	
 
          id : <id_given_in_input>
 
          result : {
 
            [repo_object, repo_object,...]
 
          }
 
          error :  null
 
        """
 

	
 
        if not HasPermissionAny('hg.admin')():
 
            # make sure normal user does not pass someone else userid,
 
            # he is not allowed to do that
 
            if not isinstance(userid, Optional) and userid != request.authuser.user_id:
 
                raise JSONRPCError(
 
                    'userid is not the same as your user'
 
                )
 

	
 
        ret = []
 
        if isinstance(userid, Optional):
 
            user = None
 
        else:
 
            user = get_user_or_error(userid)
 

	
 
        # show all locks
 
        for r in Repository.query():
 
            userid, time_ = r.locked
 
            if time_:
 
                _api_data = r.get_api_data()
 
                # if we use userfilter just show the locks for this user
 
                if user is not None:
 
                    if safe_int(userid) == user.user_id:
 
                        ret.append(_api_data)
 
                else:
 
                    ret.append(_api_data)
 

	
 
        return ret
 

	
 
    @HasPermissionAnyDecorator('hg.admin')
 
    def get_ip(self, userid=Optional(OAttr('apiuser'))):
 
        """
 
@@ -1069,7 +898,7 @@ class ApiController(JSONRPCController):
 

	
 
        try:
 
            ugm = UserGroupModel().add_user_to_group(user_group, user)
 
            success = True if ugm != True else False
 
            success = True if ugm is not True else False
 
            msg = 'added member `%s` to user group `%s`' % (
 
                user.username, user_group.users_group_name
 
            )
 
@@ -1155,7 +984,6 @@ class ApiController(JSONRPCController):
 
                "repo_type" :        "<repo_type>",
 
                "clone_uri" :        "<clone_uri>",
 
                "enable_downloads":  "<bool>",
 
                "enable_locking":    "<bool>",
 
                "enable_statistics": "<bool>",
 
                "private":           "<bool>",
 
                "created_on" :       "<date_time_created>",
 
@@ -1266,7 +1094,6 @@ class ApiController(JSONRPCController):
 
                        "owner":             "<repo_owner>",
 
                        "fork_of":           "<name_of_fork_parent>",
 
                        "enable_downloads":  "<bool>",
 
                        "enable_locking":    "<bool>",
 
                        "enable_statistics": "<bool>",
 
                      },
 
 
@@ -1346,7 +1173,6 @@ class ApiController(JSONRPCController):
 
                    private=Optional(False), clone_uri=Optional(None),
 
                    landing_rev=Optional('rev:tip'),
 
                    enable_statistics=Optional(False),
 
                    enable_locking=Optional(False),
 
                    enable_downloads=Optional(False),
 
                    copy_permissions=Optional(False)):
 
        """
 
@@ -1371,8 +1197,6 @@ class ApiController(JSONRPCController):
 
        :type clone_uri: str
 
        :param landing_rev: <rev_type>:<rev>
 
        :type landing_rev: str
 
        :param enable_locking:
 
        :type enable_locking: bool
 
        :param enable_downloads:
 
        :type enable_downloads: bool
 
        :param enable_statistics:
 
@@ -1421,8 +1245,6 @@ class ApiController(JSONRPCController):
 
            repo_type = defs.get('repo_type')
 
        if isinstance(enable_statistics, Optional):
 
            enable_statistics = defs.get('repo_enable_statistics')
 
        if isinstance(enable_locking, Optional):
 
            enable_locking = defs.get('repo_enable_locking')
 
        if isinstance(enable_downloads, Optional):
 
            enable_downloads = defs.get('repo_enable_downloads')
 

	
 
@@ -1450,7 +1272,6 @@ class ApiController(JSONRPCController):
 
                repo_group=repo_group,
 
                repo_landing_rev=landing_rev,
 
                enable_statistics=enable_statistics,
 
                enable_locking=enable_locking,
 
                enable_downloads=enable_downloads,
 
                repo_copy_permissions=copy_permissions,
 
            )
 
@@ -1476,7 +1297,6 @@ class ApiController(JSONRPCController):
 
                    description=Optional(''), private=Optional(False),
 
                    clone_uri=Optional(None), landing_rev=Optional('rev:tip'),
 
                    enable_statistics=Optional(False),
 
                    enable_locking=Optional(False),
 
                    enable_downloads=Optional(False)):
 

	
 
        """
 
@@ -1492,7 +1312,6 @@ class ApiController(JSONRPCController):
 
        :param clone_uri:
 
        :param landing_rev:
 
        :param enable_statistics:
 
        :param enable_locking:
 
        :param enable_downloads:
 
        """
 
        repo = get_repo_or_error(repoid)
 
@@ -1502,7 +1321,7 @@ class ApiController(JSONRPCController):
 

	
 
            if (name != repo.repo_name and
 
                not HasPermissionAny('hg.create.repository')()
 
                ):
 
            ):
 
                raise JSONRPCError('no permission to create (or move) repositories')
 

	
 
            if not isinstance(owner, Optional):
 
@@ -1525,7 +1344,6 @@ class ApiController(JSONRPCController):
 
            store_update(updates, clone_uri, 'clone_uri')
 
            store_update(updates, landing_rev, 'repo_landing_rev')
 
            store_update(updates, enable_statistics, 'repo_enable_statistics')
 
            store_update(updates, enable_locking, 'repo_enable_locking')
 
            store_update(updates, enable_downloads, 'repo_enable_downloads')
 

	
 
            RepoModel().update(repo, **updates)
 
@@ -2020,7 +1838,7 @@ class ApiController(JSONRPCController):
 
    def update_repo_group(self, repogroupid, group_name=Optional(''),
 
                          description=Optional(''),
 
                          owner=Optional(OAttr('apiuser')),
 
                          parent=Optional(None), enable_locking=Optional(False)):
 
                          parent=Optional(None)):
 
        repo_group = get_repo_group_or_error(repogroupid)
 

	
 
        updates = {}
 
@@ -2029,7 +1847,6 @@ class ApiController(JSONRPCController):
 
            store_update(updates, description, 'group_description')
 
            store_update(updates, owner, 'owner')
 
            store_update(updates, parent, 'parent_group')
 
            store_update(updates, enable_locking, 'enable_locking')
 
            repo_group = RepoGroupModel().update(repo_group, updates)
 
            Session().commit()
 
            return dict(
 
@@ -2443,6 +2260,7 @@ class ApiController(JSONRPCController):
 

	
 
            gist = GistModel().create(description=description,
 
                                      owner=owner,
 
                                      ip_addr=request.ip_addr,
 
                                      gist_mapping=files,
 
                                      gist_type=gist_type,
 
                                      lifetime=lifetime)
 
@@ -2536,9 +2354,9 @@ class ApiController(JSONRPCController):
 

	
 
        with_reviews = Optional.extract(with_reviews)
 
        if with_reviews:
 
                reviews = ChangesetStatusModel().get_statuses(
 
                                    repo.repo_name, raw_id)
 
                info["reviews"] = reviews
 
            reviews = ChangesetStatusModel().get_statuses(
 
                                repo.repo_name, raw_id)
 
            info["reviews"] = reviews
 

	
 
        return info
 

	
kallithea/controllers/changelog.py
Show inline comments
 
@@ -28,19 +28,19 @@ Original author and date, and relevant c
 
import logging
 
import traceback
 

	
 
from tg import request, session, tmpl_context as c
 
from tg import request, session
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from webob.exc import HTTPFound, HTTPNotFound, HTTPBadRequest
 
from webob.exc import HTTPBadRequest, HTTPFound, HTTPNotFound
 

	
 
import kallithea.lib.helpers as h
 
from kallithea.config.routing import url
 
from kallithea.lib.auth import LoginRequired, HasRepoPermissionLevelDecorator
 
from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired
 
from kallithea.lib.base import BaseRepoController, render
 
from kallithea.lib.graphmod import graph_data
 
from kallithea.lib.page import RepoPage
 
from kallithea.lib.vcs.exceptions import RepositoryError, ChangesetDoesNotExistError, \
 
    ChangesetError, NodeDoesNotExistError, EmptyRepositoryError
 
from kallithea.lib.utils2 import safe_int, safe_str
 
from kallithea.lib.vcs.exceptions import ChangesetDoesNotExistError, ChangesetError, EmptyRepositoryError, NodeDoesNotExistError, RepositoryError
 

	
 

	
 
log = logging.getLogger(__name__)
 
@@ -88,7 +88,8 @@ class ChangelogController(BaseRepoContro
 
        if (branch_name and
 
            branch_name not in c.db_repo_scm_instance.branches and
 
            branch_name not in c.db_repo_scm_instance.closed_branches and
 
            not revision):
 
            not revision
 
        ):
 
            raise HTTPFound(location=url('changelog_file_home', repo_name=c.repo_name,
 
                                    revision=branch_name, f_path=f_path or ''))
 

	
kallithea/controllers/changeset.py
Show inline comments
 
@@ -27,30 +27,28 @@ Original author and date, and relevant c
 

	
 
import logging
 
import traceback
 
from collections import defaultdict
 
from collections import OrderedDict, defaultdict
 

	
 
from tg import tmpl_context as c, request, response
 
from tg import request, response
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from webob.exc import HTTPFound, HTTPForbidden, HTTPBadRequest, HTTPNotFound
 

	
 
from kallithea.lib.vcs.exceptions import RepositoryError, \
 
    ChangesetDoesNotExistError, EmptyRepositoryError
 
from webob.exc import HTTPBadRequest, HTTPForbidden, HTTPFound, HTTPNotFound
 

	
 
import kallithea.lib.helpers as h
 
from kallithea.lib.auth import LoginRequired, HasRepoPermissionLevelDecorator
 
from kallithea.lib.base import BaseRepoController, render, jsonify
 
from kallithea.lib import diffs
 
from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired
 
from kallithea.lib.base import BaseRepoController, jsonify, render
 
from kallithea.lib.graphmod import graph_data
 
from kallithea.lib.utils import action_logger
 
from kallithea.lib.compat import OrderedDict
 
from kallithea.lib import diffs
 
from kallithea.lib.utils2 import safe_unicode
 
from kallithea.lib.vcs.backends.base import EmptyChangeset
 
from kallithea.lib.vcs.exceptions import ChangesetDoesNotExistError, EmptyRepositoryError, RepositoryError
 
from kallithea.model.changeset_status import ChangesetStatusModel
 
from kallithea.model.comment import ChangesetCommentsModel
 
from kallithea.model.db import ChangesetComment, ChangesetStatus
 
from kallithea.model.comment import ChangesetCommentsModel
 
from kallithea.model.changeset_status import ChangesetStatusModel
 
from kallithea.model.meta import Session
 
from kallithea.model.pull_request import PullRequestModel
 
from kallithea.model.repo import RepoModel
 
from kallithea.lib.vcs.backends.base import EmptyChangeset
 
from kallithea.lib.utils2 import safe_unicode
 
from kallithea.lib.graphmod import graph_data
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 
@@ -208,7 +206,7 @@ def create_cs_pr_comment(repo_name, revi
 
            h.HasPermissionAny('hg.admin')() or
 
            h.HasRepoPermissionLevel('admin')(pull_request.org_repo.repo_name) or
 
            h.HasRepoPermissionLevel('admin')(pull_request.other_repo.repo_name)
 
            ) and not pull_request.is_closed():
 
        ) and not pull_request.is_closed():
 
            PullRequestModel().delete(pull_request)
 
            Session().commit()
 
            h.flash(_('Successfully deleted pull request %s') % pull_request_id,
kallithea/controllers/compare.py
Show inline comments
 
@@ -30,20 +30,22 @@ Original author and date, and relevant c
 
import logging
 
import re
 

	
 
from tg import request, tmpl_context as c
 
from tg import request
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from webob.exc import HTTPFound, HTTPBadRequest, HTTPNotFound
 
from webob.exc import HTTPBadRequest, HTTPFound, HTTPNotFound
 

	
 
from kallithea.config.routing import url
 
from kallithea.lib.utils2 import safe_str, safe_int
 
from kallithea.lib.vcs.utils.hgcompat import unionrepo
 
from kallithea.controllers.changeset import _context_url, _ignorews_url
 
from kallithea.lib import diffs
 
from kallithea.lib import helpers as h
 
from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired
 
from kallithea.lib.base import BaseRepoController, render
 
from kallithea.lib.auth import LoginRequired, HasRepoPermissionLevelDecorator
 
from kallithea.lib import diffs
 
from kallithea.lib.graphmod import graph_data
 
from kallithea.lib.utils2 import safe_int, safe_str
 
from kallithea.lib.vcs.utils.hgcompat import unionrepo
 
from kallithea.model.db import Repository
 
from kallithea.controllers.changeset import _ignorews_url, _context_url
 
from kallithea.lib.graphmod import graph_data
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
kallithea/controllers/error.py
Show inline comments
 
@@ -25,14 +25,15 @@ Original author and date, and relevant c
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 

	
 
import os
 
import cgi
 
import logging
 

	
 
from tg import tmpl_context as c, request, config, expose
 
from tg import config, expose, request
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 

	
 
from kallithea.lib.base import BaseController, render
 
from kallithea.lib.base import BaseController
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
kallithea/controllers/feed.py
Show inline comments
 
@@ -28,19 +28,19 @@ Original author and date, and relevant c
 

	
 
import logging
 

	
 
from tg import response, tmpl_context as c
 
from beaker.cache import cache_region
 
from tg import response
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 

	
 
from beaker.cache import cache_region, region_invalidate
 
from webhelpers.feedgenerator import Atom1Feed, Rss201rev2Feed
 

	
 
from kallithea import CONFIG
 
from kallithea.lib import helpers as h
 
from kallithea.lib.auth import LoginRequired, HasRepoPermissionLevelDecorator
 
from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired
 
from kallithea.lib.base import BaseRepoController
 
from kallithea.lib.diffs import DiffProcessor
 
from kallithea.model.db import CacheInvalidation
 
from kallithea.lib.utils2 import safe_int, str2bool, safe_unicode
 
from kallithea.lib.utils2 import safe_int, safe_unicode, str2bool
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 
@@ -51,7 +51,7 @@ ttl = "5"
 

	
 
class FeedController(BaseRepoController):
 

	
 
    @LoginRequired(api_access=True, allow_default_user=True)
 
    @LoginRequired(allow_default_user=True)
 
    @HasRepoPermissionLevelDecorator('read')
 
    def _before(self, *args, **kwargs):
 
        super(FeedController, self)._before(*args, **kwargs)
 
@@ -106,7 +106,7 @@ class FeedController(BaseRepoController)
 
        """Produce an atom-1.0 feed via feedgenerator module"""
 

	
 
        @cache_region('long_term', '_get_feed_from_cache')
 
        def _get_feed_from_cache(key, kind):
 
        def _get_feed_from_cache(*_cache_keys):  # parameters are not really used - only as caching key
 
            feed = Atom1Feed(
 
                title=_('%s %s feed') % (c.site_name, repo_name),
 
                link=h.canonical_url('summary_home', repo_name=repo_name),
 
@@ -129,16 +129,13 @@ class FeedController(BaseRepoController)
 
            return feed.writeString('utf-8')
 

	
 
        kind = 'ATOM'
 
        valid = CacheInvalidation.test_and_set_valid(repo_name, kind)
 
        if not valid:
 
            region_invalidate(_get_feed_from_cache, None, '_get_feed_from_cache', repo_name, kind)
 
        return _get_feed_from_cache(repo_name, kind)
 
        return _get_feed_from_cache(repo_name, kind, c.db_repo.changeset_cache.get('raw_id'))
 

	
 
    def rss(self, repo_name):
 
        """Produce an rss2 feed via feedgenerator module"""
 

	
 
        @cache_region('long_term', '_get_feed_from_cache')
 
        def _get_feed_from_cache(key, kind):
 
        def _get_feed_from_cache(*_cache_keys):  # parameters are not really used - only as caching key
 
            feed = Rss201rev2Feed(
 
                title=_('%s %s feed') % (c.site_name, repo_name),
 
                link=h.canonical_url('summary_home', repo_name=repo_name),
 
@@ -161,7 +158,4 @@ class FeedController(BaseRepoController)
 
            return feed.writeString('utf-8')
 

	
 
        kind = 'RSS'
 
        valid = CacheInvalidation.test_and_set_valid(repo_name, kind)
 
        if not valid:
 
            region_invalidate(_get_feed_from_cache, None, '_get_feed_from_cache', repo_name, kind)
 
        return _get_feed_from_cache(repo_name, kind)
 
        return _get_feed_from_cache(repo_name, kind, c.db_repo.changeset_cache.get('raw_id'))
kallithea/controllers/files.py
Show inline comments
 
@@ -25,43 +25,36 @@ Original author and date, and relevant c
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 

	
 
import logging
 
import os
 
import posixpath
 
import logging
 
import traceback
 
import shutil
 
import tempfile
 
import shutil
 
import traceback
 
from collections import OrderedDict
 

	
 
from tg import request, response, tmpl_context as c
 
from tg import request, response
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from webob.exc import HTTPFound
 
from webob.exc import HTTPFound, HTTPNotFound
 

	
 
from kallithea.config.routing import url
 
from kallithea.lib.utils import action_logger
 
from kallithea.controllers.changeset import _context_url, _ignorews_url, anchor_url, get_ignore_ws, get_line_ctx
 
from kallithea.lib import diffs
 
from kallithea.lib import helpers as h
 

	
 
from kallithea.lib.compat import OrderedDict
 
from kallithea.lib.utils2 import convert_line_endings, detect_mode, safe_str, \
 
    str2bool, safe_int
 
from kallithea.lib.auth import LoginRequired, HasRepoPermissionLevelDecorator
 
from kallithea.lib.base import BaseRepoController, render, jsonify
 
from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired
 
from kallithea.lib.base import BaseRepoController, jsonify, render
 
from kallithea.lib.exceptions import NonRelativePathError
 
from kallithea.lib.utils import action_logger
 
from kallithea.lib.utils2 import convert_line_endings, detect_mode, safe_int, safe_str, str2bool
 
from kallithea.lib.vcs.backends.base import EmptyChangeset
 
from kallithea.lib.vcs.conf import settings
 
from kallithea.lib.vcs.exceptions import RepositoryError, \
 
    ChangesetDoesNotExistError, EmptyRepositoryError, \
 
    ImproperArchiveTypeError, VCSError, NodeAlreadyExistsError, \
 
    NodeDoesNotExistError, ChangesetError, NodeError
 
from kallithea.lib.vcs.exceptions import (
 
    ChangesetDoesNotExistError, ChangesetError, EmptyRepositoryError, ImproperArchiveTypeError, NodeAlreadyExistsError, NodeDoesNotExistError, NodeError, RepositoryError, VCSError)
 
from kallithea.lib.vcs.nodes import FileNode
 

	
 
from kallithea.model.db import Repository
 
from kallithea.model.repo import RepoModel
 
from kallithea.model.scm import ScmModel
 
from kallithea.model.db import Repository
 

	
 
from kallithea.controllers.changeset import anchor_url, _ignorews_url, \
 
    _context_url, get_line_ctx, get_ignore_ws
 
from webob.exc import HTTPNotFound
 
from kallithea.lib.exceptions import NonRelativePathError
 

	
 

	
 
log = logging.getLogger(__name__)
 
@@ -295,14 +288,6 @@ class FilesController(BaseRepoController
 
    @HasRepoPermissionLevelDecorator('write')
 
    def delete(self, repo_name, revision, f_path):
 
        repo = c.db_repo
 
        if repo.enable_locking and repo.locked[0]:
 
            h.flash(_('This repository has been locked by %s on %s')
 
                % (h.person_by_id(repo.locked[0]),
 
                   h.fmt_date(h.time_to_datetime(repo.locked[1]))),
 
                'warning')
 
            raise HTTPFound(location=h.url('files_home',
 
                                  repo_name=repo_name, revision='tip'))
 

	
 
        # check if revision is a branch identifier- basically we cannot
 
        # create multiple heads via file editing
 
        _branches = repo.scm_instance.branches
 
@@ -334,7 +319,9 @@ class FilesController(BaseRepoController
 
                    }
 
                }
 
                self.scm_model.delete_nodes(
 
                    user=request.authuser.user_id, repo=c.db_repo,
 
                    user=request.authuser.user_id,
 
                    ip_addr=request.ip_addr,
 
                    repo=c.db_repo,
 
                    message=message,
 
                    nodes=nodes,
 
                    parent_cs=c.cs,
 
@@ -355,14 +342,6 @@ class FilesController(BaseRepoController
 
    @HasRepoPermissionLevelDecorator('write')
 
    def edit(self, repo_name, revision, f_path):
 
        repo = c.db_repo
 
        if repo.enable_locking and repo.locked[0]:
 
            h.flash(_('This repository has been locked by %s on %s')
 
                % (h.person_by_id(repo.locked[0]),
 
                   h.fmt_date(h.time_to_datetime(repo.locked[1]))),
 
                'warning')
 
            raise HTTPFound(location=h.url('files_home',
 
                                  repo_name=repo_name, revision='tip'))
 

	
 
        # check if revision is a branch identifier- basically we cannot
 
        # create multiple heads via file editing
 
        _branches = repo.scm_instance.branches
 
@@ -405,6 +384,7 @@ class FilesController(BaseRepoController
 
                self.scm_model.commit_change(repo=c.db_repo_scm_instance,
 
                                             repo_name=repo_name, cs=c.cs,
 
                                             user=request.authuser.user_id,
 
                                             ip_addr=request.ip_addr,
 
                                             author=author, message=message,
 
                                             content=content, f_path=f_path)
 
                h.flash(_('Successfully committed to %s') % f_path,
 
@@ -422,14 +402,6 @@ class FilesController(BaseRepoController
 
    def add(self, repo_name, revision, f_path):
 

	
 
        repo = c.db_repo
 
        if repo.enable_locking and repo.locked[0]:
 
            h.flash(_('This repository has been locked by %s on %s')
 
                % (h.person_by_id(repo.locked[0]),
 
                   h.fmt_date(h.time_to_datetime(repo.locked[1]))),
 
                  'warning')
 
            raise HTTPFound(location=h.url('files_home',
 
                                  repo_name=repo_name, revision='tip'))
 

	
 
        r_post = request.POST
 
        c.cs = self.__get_cs(revision, silent_empty=True)
 
        if c.cs is None:
 
@@ -474,7 +446,9 @@ class FilesController(BaseRepoController
 
                    }
 
                }
 
                self.scm_model.create_nodes(
 
                    user=request.authuser.user_id, repo=c.db_repo,
 
                    user=request.authuser.user_id,
 
                    ip_addr=request.ip_addr,
 
                    repo=c.db_repo,
 
                    message=message,
 
                    nodes=nodes,
 
                    parent_cs=c.cs,
kallithea/controllers/followers.py
Show inline comments
 
@@ -27,14 +27,16 @@ Original author and date, and relevant c
 

	
 
import logging
 

	
 
from tg import tmpl_context as c, request
 
from tg import request
 
from tg import tmpl_context as c
 

	
 
from kallithea.lib.auth import LoginRequired, HasRepoPermissionLevelDecorator
 
from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired
 
from kallithea.lib.base import BaseRepoController, render
 
from kallithea.lib.page import Page
 
from kallithea.lib.utils2 import safe_int
 
from kallithea.model.db import UserFollowing
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
kallithea/controllers/forks.py
Show inline comments
 
@@ -26,26 +26,26 @@ Original author and date, and relevant c
 
"""
 

	
 
import logging
 
import traceback
 

	
 
import formencode
 
import traceback
 
from formencode import htmlfill
 

	
 
from tg import tmpl_context as c, request
 
from tg import request
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from webob.exc import HTTPFound
 

	
 
import kallithea.lib.helpers as h
 

	
 
from kallithea.config.routing import url
 
from kallithea.lib.auth import LoginRequired, HasRepoPermissionLevelDecorator, \
 
    HasRepoPermissionLevel, HasPermissionAnyDecorator, HasPermissionAny
 
from kallithea.lib.auth import HasPermissionAny, HasPermissionAnyDecorator, HasRepoPermissionLevel, HasRepoPermissionLevelDecorator, LoginRequired
 
from kallithea.lib.base import BaseRepoController, render
 
from kallithea.lib.page import Page
 
from kallithea.lib.utils2 import safe_int
 
from kallithea.model.db import Repository, UserFollowing, User, Ui
 
from kallithea.model.db import Repository, Ui, User, UserFollowing
 
from kallithea.model.forms import RepoForkForm
 
from kallithea.model.repo import RepoModel
 
from kallithea.model.forms import RepoForkForm
 
from kallithea.model.scm import ScmModel, AvailableRepoGroupChoices
 
from kallithea.model.scm import AvailableRepoGroupChoices, ScmModel
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 
@@ -82,7 +82,7 @@ class ForksController(BaseRepoController
 
            .filter(UserFollowing.follows_repository == c.repo_info).scalar()
 

	
 
        if c.repo_info.stats:
 
            last_rev = c.repo_info.stats.stat_on_revision+1
 
            last_rev = c.repo_info.stats.stat_on_revision + 1
 
        else:
 
            last_rev = 0
 
        c.stats_revision = last_rev
kallithea/controllers/home.py
Show inline comments
 
@@ -28,20 +28,21 @@ Original author and date, and relevant c
 

	
 
import logging
 

	
 
from tg import tmpl_context as c, request
 
from sqlalchemy import or_
 
from tg import request
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from webob.exc import HTTPBadRequest
 
from sqlalchemy.sql.expression import func
 
from sqlalchemy import or_, and_
 

	
 
from kallithea.lib import helpers as h
 
from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired
 
from kallithea.lib.base import BaseController, jsonify, render
 
from kallithea.lib.utils import conditional_cache
 
from kallithea.lib.auth import LoginRequired, HasRepoPermissionLevelDecorator
 
from kallithea.lib.base import BaseController, render, jsonify
 
from kallithea.lib import helpers as h
 
from kallithea.model.db import Repository, RepoGroup, User, UserGroup
 
from kallithea.model.db import RepoGroup, Repository, User, UserGroup
 
from kallithea.model.repo import RepoModel
 
from kallithea.model.scm import UserGroupList
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
@@ -173,9 +174,9 @@ class HomeController(BaseController):
 
                    .filter(User.is_default_user == False) \
 
                    .filter(User.active == True) \
 
                    .filter(or_(
 
                        User.username.ilike("%%"+query+"%%"),
 
                        User.name.ilike("%%"+query+"%%"),
 
                        User.lastname.ilike("%%"+query+"%%"),
 
                        User.username.ilike("%%" + query + "%%"),
 
                        User.name.ilike("%%" + query + "%%"),
 
                        User.lastname.ilike("%%" + query + "%%"),
 
                    )) \
 
                    .order_by(User.username) \
 
                    .limit(500) \
 
@@ -198,7 +199,7 @@ class HomeController(BaseController):
 
                    grp_list = [grp]
 
            elif query:
 
                grp_list = UserGroup.query() \
 
                    .filter(UserGroup.users_group_name.ilike("%%"+query+"%%")) \
 
                    .filter(UserGroup.users_group_name.ilike("%%" + query + "%%")) \
 
                    .filter(UserGroup.users_group_active == True) \
 
                    .order_by(UserGroup.users_group_name) \
 
                    .limit(500) \
kallithea/controllers/journal.py
Show inline comments
 
@@ -32,24 +32,23 @@ from itertools import groupby
 

	
 
from sqlalchemy import or_
 
from sqlalchemy.orm import joinedload
 
from sqlalchemy.sql.expression import func
 

	
 
from tg import request, response
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from webhelpers.feedgenerator import Atom1Feed, Rss201rev2Feed
 
from webob.exc import HTTPBadRequest
 

	
 
from webob.exc import HTTPBadRequest
 
from tg import request, tmpl_context as c, response
 
from tg.i18n import ugettext as _
 

	
 
import kallithea.lib.helpers as h
 
from kallithea.config.routing import url
 
from kallithea.controllers.admin.admin import _journal_filter
 
from kallithea.model.db import UserLog, UserFollowing, Repository, User
 
from kallithea.model.meta import Session
 
from kallithea.model.repo import RepoModel
 
import kallithea.lib.helpers as h
 
from kallithea.lib.auth import LoginRequired
 
from kallithea.lib.base import BaseController, render
 
from kallithea.lib.page import Page
 
from kallithea.lib.utils2 import safe_int, AttributeDict
 
from kallithea.lib.utils2 import AttributeDict, safe_int
 
from kallithea.model.db import Repository, User, UserFollowing, UserLog
 
from kallithea.model.meta import Session
 
from kallithea.model.repo import RepoModel
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 
@@ -220,7 +219,7 @@ class JournalController(BaseController):
 

	
 
        return render('journal/journal.html')
 

	
 
    @LoginRequired(api_access=True)
 
    @LoginRequired()
 
    def journal_atom(self):
 
        """
 
        Produce an atom-1.0 feed via feedgenerator module
 
@@ -231,7 +230,7 @@ class JournalController(BaseController):
 
            .all()
 
        return self._atom_feed(following, public=False)
 

	
 
    @LoginRequired(api_access=True)
 
    @LoginRequired()
 
    def journal_rss(self):
 
        """
 
        Produce an rss feed via feedgenerator module
 
@@ -289,7 +288,7 @@ class JournalController(BaseController):
 

	
 
        return render('journal/public_journal.html')
 

	
 
    @LoginRequired(api_access=True, allow_default_user=True)
 
    @LoginRequired(allow_default_user=True)
 
    def public_journal_atom(self):
 
        """
 
        Produce an atom-1.0 feed via feedgenerator module
 
@@ -301,7 +300,7 @@ class JournalController(BaseController):
 

	
 
        return self._atom_feed(c.following)
 

	
 
    @LoginRequired(api_access=True, allow_default_user=True)
 
    @LoginRequired(allow_default_user=True)
 
    def public_journal_rss(self):
 
        """
 
        Produce an rss2 feed via feedgenerator module
kallithea/controllers/login.py
Show inline comments
 
@@ -28,12 +28,13 @@ Original author and date, and relevant c
 

	
 
import logging
 
import re
 

	
 
import formencode
 

	
 
from formencode import htmlfill
 
from tg import request, session
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from tg import request, session, tmpl_context as c
 
from webob.exc import HTTPFound, HTTPBadRequest
 
from webob.exc import HTTPBadRequest, HTTPFound
 

	
 
import kallithea.lib.helpers as h
 
from kallithea.config.routing import url
 
@@ -41,11 +42,10 @@ from kallithea.lib.auth import AuthUser,
 
from kallithea.lib.base import BaseController, log_in_user, render
 
from kallithea.lib.exceptions import UserCreationError
 
from kallithea.lib.utils2 import safe_str
 
from kallithea.model.db import User, Setting
 
from kallithea.model.forms import \
 
    LoginForm, RegisterForm, PasswordResetRequestForm, PasswordResetConfirmationForm
 
from kallithea.model.db import Setting, User
 
from kallithea.model.forms import LoginForm, PasswordResetConfirmationForm, PasswordResetRequestForm, RegisterForm
 
from kallithea.model.meta import Session
 
from kallithea.model.user import UserModel
 
from kallithea.model.meta import Session
 

	
 

	
 
log = logging.getLogger(__name__)
 
@@ -102,13 +102,14 @@ class LoginController(BaseController):
 
                # Exception itself
 
                h.flash(e, 'error')
 
            else:
 
                log_in_user(user, c.form_result['remember'],
 
                    is_external_auth=False)
 
                auth_user = log_in_user(user, c.form_result['remember'], is_external_auth=False, ip_addr=request.ip_addr)
 
                # TODO: handle auth_user is None as failed authentication?
 
                raise HTTPFound(location=c.came_from)
 
        else:
 
            # redirect if already logged in
 
            if request.authuser.is_authenticated:
 
            if not request.authuser.is_anonymous:
 
                raise HTTPFound(location=c.came_from)
 
            # continue to show login to default user
 

	
 
        return render('/login.html')
 

	
 
@@ -248,10 +249,10 @@ class LoginController(BaseController):
 
        log.info('Logging out and deleting session for user')
 
        raise HTTPFound(location=url('home'))
 

	
 
    def authentication_token(self):
 
    def session_csrf_secret_token(self):
 
        """Return the CSRF protection token for the session - just like it
 
        could have been screen scraped from a page with a form.
 
        Only intended for testing but might also be useful for other kinds
 
        of automation.
 
        """
 
        return h.authentication_token()
 
        return h.session_csrf_secret_token()
kallithea/controllers/pullrequests.py
Show inline comments
 
@@ -27,35 +27,32 @@ Original author and date, and relevant c
 

	
 
import logging
 
import traceback
 

	
 
import formencode
 

	
 
from tg import request, tmpl_context as c
 
from tg import request
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from webob.exc import HTTPFound, HTTPNotFound, HTTPForbidden, HTTPBadRequest
 
from webob.exc import HTTPBadRequest, HTTPForbidden, HTTPFound, HTTPNotFound
 

	
 
from kallithea.config.routing import url
 
from kallithea.lib import helpers as h
 
from kallithea.controllers.changeset import _context_url, _ignorews_url, create_cs_pr_comment, delete_cs_pr_comment
 
from kallithea.lib import diffs
 
from kallithea.lib.auth import LoginRequired, HasRepoPermissionLevelDecorator
 
from kallithea.lib.base import BaseRepoController, render, jsonify
 
from kallithea.lib import helpers as h
 
from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired
 
from kallithea.lib.base import BaseRepoController, jsonify, render
 
from kallithea.lib.graphmod import graph_data
 
from kallithea.lib.page import Page
 
from kallithea.lib.utils import action_logger
 
from kallithea.lib.vcs.exceptions import EmptyRepositoryError, ChangesetDoesNotExistError
 
from kallithea.lib.utils2 import safe_int
 
from kallithea.lib.vcs.exceptions import ChangesetDoesNotExistError, EmptyRepositoryError
 
from kallithea.lib.vcs.utils import safe_str
 
from kallithea.lib.vcs.utils.hgcompat import unionrepo
 
from kallithea.model.db import PullRequest, ChangesetStatus, \
 
    PullRequestReviewer, Repository, User
 
from kallithea.model.pull_request import CreatePullRequestAction, CreatePullRequestIterationAction, PullRequestModel
 
from kallithea.model.meta import Session
 
from kallithea.model.repo import RepoModel
 
from kallithea.model.changeset_status import ChangesetStatusModel
 
from kallithea.model.comment import ChangesetCommentsModel
 
from kallithea.model.changeset_status import ChangesetStatusModel
 
from kallithea.model.db import ChangesetStatus, PullRequest, PullRequestReviewer, Repository, User
 
from kallithea.model.forms import PullRequestForm, PullRequestPostForm
 
from kallithea.lib.utils2 import safe_int
 
from kallithea.controllers.changeset import _ignorews_url, _context_url, \
 
    create_cs_pr_comment, delete_cs_pr_comment
 
from kallithea.controllers.compare import CompareController
 
from kallithea.lib.graphmod import graph_data
 
from kallithea.model.meta import Session
 
from kallithea.model.pull_request import CreatePullRequestAction, CreatePullRequestIterationAction, PullRequestModel
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 
@@ -101,7 +98,8 @@ class PullrequestsController(BaseRepoCon
 
            peerbranches = set()
 
            for i in repo._repo.revs(
 
                "sort(parents(branch(id(%s)) and merge()) - branch(id(%s)), -rev)",
 
                branch_rev, branch_rev):
 
                branch_rev, branch_rev
 
            ):
 
                for abranch in repo.get_changeset(i).branches:
 
                    if abranch not in peerbranches:
 
                        n = 'branch:%s:%s' % (abranch, repo.get_changeset(abranch).raw_id)
kallithea/controllers/root.py
Show inline comments
 
@@ -11,11 +11,12 @@
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
from tg import config
 
from tgext.routes import RoutedController
 

	
 
from kallithea.config.routing import make_map
 
from kallithea.controllers.error import ErrorController
 
from kallithea.lib.base import BaseController
 
from kallithea.controllers.error import ErrorController
 
from tg import config
 

	
 

	
 
# This is the main Kallithea entry point; TurboGears will forward all requests
 
@@ -27,7 +28,8 @@ from tg import config
 
# inheriting from its RoutedController class.
 
class RootController(RoutedController, BaseController):
 

	
 
    mapper = make_map(config)
 
    def __init__(self):
 
        self.mapper = make_map(config)
 

	
 
    # the following assignment hooks in error handling
 
    error = ErrorController()
 
        # the following assignment hooks in error handling
 
        self.error = ErrorController()
kallithea/controllers/search.py
Show inline comments
 
@@ -28,22 +28,23 @@ Original author and date, and relevant c
 
import logging
 
import traceback
 
import urllib
 

	
 
from tg import config, request
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from tg import request, config, tmpl_context as c
 

	
 
from whoosh.index import open_dir, exists_in, EmptyIndexError
 
from webhelpers2.html.tools import update_params
 
from whoosh.index import EmptyIndexError, exists_in, open_dir
 
from whoosh.qparser import QueryParser, QueryParserError
 
from whoosh.query import Phrase, Prefix
 
from webhelpers.util import update_params
 

	
 
from kallithea.lib.auth import LoginRequired
 
from kallithea.lib.base import BaseRepoController, render
 
from kallithea.lib.indexers import CHGSETS_SCHEMA, SCHEMA, CHGSET_IDX_NAME, \
 
    IDX_NAME, WhooshResultWrapper
 
from kallithea.lib.indexers import CHGSET_IDX_NAME, CHGSETS_SCHEMA, IDX_NAME, SCHEMA, WhooshResultWrapper
 
from kallithea.lib.page import Page
 
from kallithea.lib.utils2 import safe_str, safe_int
 
from kallithea.lib.utils2 import safe_int, safe_str
 
from kallithea.model.repo import RepoModel
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
@@ -84,7 +85,7 @@ class SearchController(BaseRepoControlle
 
        if c.cur_query:
 
            p = safe_int(request.GET.get('page'), 1)
 
            highlight_items = set()
 
            index_dir = config['app_conf']['index_dir']
 
            index_dir = config['index_dir']
 
            try:
 
                if not exists_in(index_dir, index_name):
 
                    raise EmptyIndexError
 
@@ -120,8 +121,7 @@ class SearchController(BaseRepoControlle
 

	
 
                    def url_generator(**kw):
 
                        q = urllib.quote(safe_str(c.cur_query))
 
                        return update_params("?q=%s&type=%s" \
 
                        % (q, safe_str(c.cur_type)), **kw)
 
                        return update_params("?q=%s&type=%s" % (q, safe_str(c.cur_type)), **kw)
 
                    repo_location = RepoModel().repos_path
 
                    c.formated_results = Page(
 
                        WhooshResultWrapper(search_type, searcher, matcher,
kallithea/controllers/summary.py
Show inline comments
 
@@ -25,32 +25,32 @@ Original author and date, and relevant c
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 

	
 
import traceback
 
import calendar
 
import logging
 
import itertools
 
import logging
 
import traceback
 
from datetime import date, timedelta
 
from time import mktime
 
from datetime import timedelta, date
 

	
 
from tg import tmpl_context as c, request
 
from beaker.cache import cache_region
 
from tg import request
 
from tg import tmpl_context as c
 
from tg.i18n import ugettext as _
 
from webob.exc import HTTPBadRequest
 

	
 
from beaker.cache import cache_region, region_invalidate
 

	
 
from kallithea.lib.vcs.exceptions import ChangesetError, EmptyRepositoryError, \
 
    NodeDoesNotExistError
 
from kallithea.config.conf import ALL_READMES, ALL_EXTS, LANGUAGES_EXTENSIONS_MAP
 
from kallithea.model.db import Statistics, CacheInvalidation, User
 
from kallithea.lib.utils2 import safe_int, safe_str
 
from kallithea.lib.auth import LoginRequired, HasRepoPermissionLevelDecorator
 
from kallithea.lib.base import BaseRepoController, render, jsonify
 
from kallithea.lib.vcs.backends.base import EmptyChangeset
 
from kallithea.lib.markup_renderer import MarkupRenderer
 
from kallithea.config.conf import ALL_EXTS, ALL_READMES, LANGUAGES_EXTENSIONS_MAP
 
from kallithea.lib.auth import HasRepoPermissionLevelDecorator, LoginRequired
 
from kallithea.lib.base import BaseRepoController, jsonify, render
 
from kallithea.lib.celerylib.tasks import get_commits_stats
 
from kallithea.lib.compat import json
 
from kallithea.lib.markup_renderer import MarkupRenderer
 
from kallithea.lib.page import RepoPage
 
from kallithea.lib.utils2 import safe_int
 
from kallithea.lib.vcs.backends.base import EmptyChangeset
 
from kallithea.lib.vcs.exceptions import ChangesetError, EmptyRepositoryError, NodeDoesNotExistError
 
from kallithea.lib.vcs.nodes import FileNode
 
from kallithea.lib.page import RepoPage
 
from kallithea.model.db import Statistics
 

	
 

	
 
log = logging.getLogger(__name__)
 

	
 
@@ -66,7 +66,7 @@ class SummaryController(BaseRepoControll
 
        log.debug('Looking for README file')
 

	
 
        @cache_region('long_term', '_get_readme_from_cache')
 
        def _get_readme_from_cache(key, kind):
 
        def _get_readme_from_cache(*_cache_keys):  # parameters are not really used - only as caching key
 
            readme_data = None
 
            readme_file = None
 
            try:
 
@@ -97,10 +97,7 @@ class SummaryController(BaseRepoControll
 
            return readme_data, readme_file
 

	
 
        kind = 'README'
 
        valid = CacheInvalidation.test_and_set_valid(repo_name, kind)
 
        if not valid:
 
            region_invalidate(_get_readme_from_cache, None, '_get_readme_from_cache', repo_name, kind)
 
        return _get_readme_from_cache(repo_name, kind)
 
        return _get_readme_from_cache(repo_name, kind, c.db_repo.changeset_cache.get('raw_id'))
 

	
 
    @LoginRequired(allow_default_user=True)
 
    @HasRepoPermissionLevelDecorator('read')
 
@@ -113,23 +110,16 @@ class SummaryController(BaseRepoControll
 
        c.cs_comments = c.db_repo.get_comments(page_revisions)
 
        c.cs_statuses = c.db_repo.statuses(page_revisions)
 

	
 
        c.ssh_repo_url = None
 
        if request.authuser.is_default_user:
 
            username = ''
 
            username = None
 
        else:
 
            username = safe_str(request.authuser.username)
 
            username = request.authuser.username
 
            if c.ssh_enabled:
 
                c.ssh_repo_url = c.db_repo.clone_url(clone_uri_tmpl=c.clone_ssh_tmpl)
 

	
 
        _def_clone_uri = _def_clone_uri_by_id = c.clone_uri_tmpl
 
        if '{repo}' in _def_clone_uri_by_id:
 
            _def_clone_uri_by_id = _def_clone_uri_by_id.replace('{repo}', '_{repoid}')
 
        elif '_{repoid}' in _def_clone_uri:
 
            _def_clone_uri = _def_clone_uri.replace('_{repoid}', '{repo}')
 
        else:
 
            log.error("Configured clone_uri_tmpl %r has no '{repo}' or '_{repoid}' and cannot toggle to use repo id URLs", c.clone_uri_tmpl)
 

	
 
        c.clone_repo_url = c.db_repo.clone_url(user=username,
 
                                                uri_tmpl=_def_clone_uri)
 
        c.clone_repo_url_id = c.db_repo.clone_url(user=username,
 
                                                uri_tmpl=_def_clone_uri_by_id)
 
        c.clone_repo_url = c.db_repo.clone_url(clone_uri_tmpl=c.clone_uri_tmpl, with_id=False, username=username)
 
        c.clone_repo_url_id = c.db_repo.clone_url(clone_uri_tmpl=c.clone_uri_tmpl, with_id=True, username=username)
 

	
 
        if c.db_repo.enable_statistics:
 
            c.show_stats = True
 
@@ -146,13 +136,12 @@ class SummaryController(BaseRepoControll
 
            c.no_data = False is c.db_repo.enable_statistics
 
            lang_stats_d = json.loads(stats.languages)
 

	
 
            lang_stats = ((x, {"count": y,
 
                               "desc": LANGUAGES_EXTENSIONS_MAP.get(x)})
 
                          for x, y in lang_stats_d.items())
 
            lang_stats = [(x, {"count": y,
 
                               "desc": LANGUAGES_EXTENSIONS_MAP.get(x, '?')})
 
                          for x, y in lang_stats_d.items()]
 
            lang_stats.sort(key=lambda k: (-k[1]['count'], k[0]))
 

	
 
            c.trending_languages = (
 
                sorted(lang_stats, reverse=True, key=lambda k: k[1])[:10]
 
            )
 
            c.trending_languages = lang_stats[:10]
 
        else:
 
            c.no_data = True
 
            c.trending_languages = []
kallithea/front-end/kallithea-select2.less
Show inline comments
 
@@ -19,6 +19,7 @@
 
    > .select2-chosen {
 
      margin-right: inherit; // don't leave room for .select2-arrow
 
      line-height: inherit;
 
      padding: 0;
 
    }
 
    > .select2-arrow {
 
      display: none;
 
@@ -26,6 +27,12 @@
 
  }
 
}
 

	
 
.select2-chosen,
 
.select2-choice > span:first-child,
 
.select2-container .select2-choices .select2-search-field input {
 
    padding: 0 12px;
 
}
 

	
 
// Style these like Bootstrap .dropdown-menu
 
.branch-switcher-dropdown.select2-drop.select2-drop-active,
 
.repo-switcher-dropdown.select2-drop.select2-drop-active {
 
@@ -66,3 +73,7 @@
 
.select2-container.input-sm input {
 
  .input-sm;
 
}
 

	
 
.form-inline .select2-container.form-control {
 
  display: inline-block;
 
}
kallithea/front-end/kallithea-variables.less
Show inline comments
 
@@ -41,7 +41,7 @@
 
@panel-primary-border:              @panel-primary-heading-bg;
 
@headings-font-weight:              700;
 
@table-cell-padding:                2px 4px;
 
@icon-font-path:                    ; /* no glyphicons */
 
@icon-font-path:                    ""; /* no glyphicons */
 
@icon-font-name:                    none;
 

	
 
/* custom variables */
kallithea/front-end/package-lock.json
Show inline comments
 
new file 100644
 
{
 
  "name": "kallithea",
 
  "requires": true,
 
  "lockfileVersion": 1,
 
  "dependencies": {
 
    "abbrev": {
 
      "version": "1.1.1",
 
      "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
 
      "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
 
      "dev": true
 
    },
 
    "ajv": {
 
      "version": "6.10.2",
 
      "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz",
 
      "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "fast-deep-equal": "^2.0.1",
 
        "fast-json-stable-stringify": "^2.0.0",
 
        "json-schema-traverse": "^0.4.1",
 
        "uri-js": "^4.2.2"
 
      }
 
    },
 
    "amdefine": {
 
      "version": "1.0.1",
 
      "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz",
 
      "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=",
 
      "dev": true
 
    },
 
    "ansi-styles": {
 
      "version": "3.2.1",
 
      "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
 
      "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
 
      "dev": true,
 
      "requires": {
 
        "color-convert": "^1.9.0"
 
      }
 
    },
 
    "array-find-index": {
 
      "version": "1.0.2",
 
      "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz",
 
      "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=",
 
      "dev": true
 
    },
 
    "asap": {
 
      "version": "2.0.6",
 
      "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
 
      "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=",
 
      "dev": true
 
    },
 
    "asn1": {
 
      "version": "0.2.4",
 
      "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
 
      "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "safer-buffer": "~2.1.0"
 
      }
 
    },
 
    "assert-plus": {
 
      "version": "1.0.0",
 
      "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
 
      "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "asynckit": {
 
      "version": "0.4.0",
 
      "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
 
      "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "at.js": {
 
      "version": "1.5.4",
 
      "resolved": "https://registry.npmjs.org/at.js/-/at.js-1.5.4.tgz",
 
      "integrity": "sha512-G8mgUb/PqShPoH8AyjuxsTGvIr1o716BtQUKDM44C8qN2W615y7KGJ68MlTGamd0J0D/m28emUkzagaHTdrGZw=="
 
    },
 
    "aws-sign2": {
 
      "version": "0.7.0",
 
      "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
 
      "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "aws4": {
 
      "version": "1.8.0",
 
      "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz",
 
      "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "balanced-match": {
 
      "version": "1.0.0",
 
      "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
 
      "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
 
      "dev": true
 
    },
 
    "bcrypt-pbkdf": {
 
      "version": "1.0.2",
 
      "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
 
      "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "tweetnacl": "^0.14.3"
 
      }
 
    },
 
    "bootstrap": {
 
      "version": "3.3.7",
 
      "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-3.3.7.tgz",
 
      "integrity": "sha1-WjiTlFSfIzMIdaOxUGVldPip63E="
 
    },
 
    "brace-expansion": {
 
      "version": "1.1.11",
 
      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
 
      "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
 
      "dev": true,
 
      "requires": {
 
        "balanced-match": "^1.0.0",
 
        "concat-map": "0.0.1"
 
      }
 
    },
 
    "caseless": {
 
      "version": "0.12.0",
 
      "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
 
      "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "chalk": {
 
      "version": "2.4.2",
 
      "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
 
      "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
 
      "dev": true,
 
      "requires": {
 
        "ansi-styles": "^3.2.1",
 
        "escape-string-regexp": "^1.0.5",
 
        "supports-color": "^5.3.0"
 
      }
 
    },
 
    "clean-css": {
 
      "version": "3.4.28",
 
      "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-3.4.28.tgz",
 
      "integrity": "sha1-vxlF6C/ICPVWlebd6uwBQA79A/8=",
 
      "dev": true,
 
      "requires": {
 
        "commander": "2.8.x",
 
        "source-map": "0.4.x"
 
      },
 
      "dependencies": {
 
        "source-map": {
 
          "version": "0.4.4",
 
          "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz",
 
          "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=",
 
          "dev": true,
 
          "requires": {
 
            "amdefine": ">=0.0.4"
 
          }
 
        }
 
      }
 
    },
 
    "clone": {
 
      "version": "2.1.2",
 
      "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz",
 
      "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=",
 
      "dev": true
 
    },
 
    "codemirror": {
 
      "version": "5.49.0",
 
      "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.49.0.tgz",
 
      "integrity": "sha512-Hyzr0HToBdZpLBN9dYFO/KlJAsKH37/cXVHPAqa+imml0R92tb9AkmsvjnXL+SluEvjjdfkDgRjc65NG5jnMYA=="
 
    },
 
    "color-convert": {
 
      "version": "1.9.3",
 
      "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
 
      "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
 
      "dev": true,
 
      "requires": {
 
        "color-name": "1.1.3"
 
      }
 
    },
 
    "color-name": {
 
      "version": "1.1.3",
 
      "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
 
      "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
 
      "dev": true
 
    },
 
    "combined-stream": {
 
      "version": "1.0.8",
 
      "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
 
      "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "delayed-stream": "~1.0.0"
 
      }
 
    },
 
    "commander": {
 
      "version": "2.8.1",
 
      "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz",
 
      "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=",
 
      "dev": true,
 
      "requires": {
 
        "graceful-readlink": ">= 1.0.0"
 
      }
 
    },
 
    "concat-map": {
 
      "version": "0.0.1",
 
      "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
 
      "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
 
      "dev": true
 
    },
 
    "core-util-is": {
 
      "version": "1.0.2",
 
      "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
 
      "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "dashdash": {
 
      "version": "1.14.1",
 
      "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
 
      "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "assert-plus": "^1.0.0"
 
      }
 
    },
 
    "datatables.net": {
 
      "version": "1.10.20",
 
      "resolved": "https://registry.npmjs.org/datatables.net/-/datatables.net-1.10.20.tgz",
 
      "integrity": "sha512-4E4S7tTU607N3h0fZPkGmAtr9mwy462u+VJ6gxYZ8MxcRIjZqHy3Dv1GNry7i3zQCktTdWbULVKBbkAJkuHEnQ==",
 
      "requires": {
 
        "jquery": ">=1.7"
 
      }
 
    },
 
    "datatables.net-bs": {
 
      "version": "1.10.20",
 
      "resolved": "https://registry.npmjs.org/datatables.net-bs/-/datatables.net-bs-1.10.20.tgz",
 
      "integrity": "sha512-NsMoOOYZ6NlteOpzhltw21lXsNdhjIMbIOxnqmcrb62ntl8eL9pYzk2AeiDXBlIKY4e550ZrExCq3CYKQ9myEg==",
 
      "requires": {
 
        "datatables.net": "1.10.20",
 
        "jquery": ">=1.7"
 
      }
 
    },
 
    "debug": {
 
      "version": "3.2.6",
 
      "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
 
      "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
 
      "dev": true,
 
      "requires": {
 
        "ms": "^2.1.1"
 
      }
 
    },
 
    "debuglog": {
 
      "version": "1.0.1",
 
      "resolved": "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz",
 
      "integrity": "sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=",
 
      "dev": true
 
    },
 
    "delayed-stream": {
 
      "version": "1.0.0",
 
      "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
 
      "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "dezalgo": {
 
      "version": "1.0.3",
 
      "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.3.tgz",
 
      "integrity": "sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY=",
 
      "dev": true,
 
      "requires": {
 
        "asap": "^2.0.0",
 
        "wrappy": "1"
 
      }
 
    },
 
    "ecc-jsbn": {
 
      "version": "0.1.2",
 
      "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
 
      "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "jsbn": "~0.1.0",
 
        "safer-buffer": "^2.1.0"
 
      }
 
    },
 
    "errno": {
 
      "version": "0.1.7",
 
      "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz",
 
      "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "prr": "~1.0.1"
 
      }
 
    },
 
    "escape-string-regexp": {
 
      "version": "1.0.5",
 
      "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
 
      "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
 
      "dev": true
 
    },
 
    "extend": {
 
      "version": "3.0.2",
 
      "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
 
      "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "extsprintf": {
 
      "version": "1.3.0",
 
      "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
 
      "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "fast-deep-equal": {
 
      "version": "2.0.1",
 
      "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
 
      "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "fast-json-stable-stringify": {
 
      "version": "2.0.0",
 
      "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
 
      "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "forever-agent": {
 
      "version": "0.6.1",
 
      "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
 
      "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "form-data": {
 
      "version": "2.3.3",
 
      "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
 
      "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "asynckit": "^0.4.0",
 
        "combined-stream": "^1.0.6",
 
        "mime-types": "^2.1.12"
 
      }
 
    },
 
    "fs.realpath": {
 
      "version": "1.0.0",
 
      "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
 
      "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
 
      "dev": true
 
    },
 
    "getpass": {
 
      "version": "0.1.7",
 
      "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
 
      "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "assert-plus": "^1.0.0"
 
      }
 
    },
 
    "glob": {
 
      "version": "7.1.6",
 
      "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
 
      "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
 
      "dev": true,
 
      "requires": {
 
        "fs.realpath": "^1.0.0",
 
        "inflight": "^1.0.4",
 
        "inherits": "2",
 
        "minimatch": "^3.0.4",
 
        "once": "^1.3.0",
 
        "path-is-absolute": "^1.0.0"
 
      }
 
    },
 
    "graceful-fs": {
 
      "version": "4.2.3",
 
      "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz",
 
      "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==",
 
      "dev": true
 
    },
 
    "graceful-readlink": {
 
      "version": "1.0.1",
 
      "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz",
 
      "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=",
 
      "dev": true
 
    },
 
    "har-schema": {
 
      "version": "2.0.0",
 
      "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
 
      "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "har-validator": {
 
      "version": "5.1.3",
 
      "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz",
 
      "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "ajv": "^6.5.5",
 
        "har-schema": "^2.0.0"
 
      }
 
    },
 
    "has-flag": {
 
      "version": "3.0.0",
 
      "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
 
      "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
 
      "dev": true
 
    },
 
    "hosted-git-info": {
 
      "version": "2.8.5",
 
      "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz",
 
      "integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg==",
 
      "dev": true
 
    },
 
    "http-signature": {
 
      "version": "1.2.0",
 
      "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
 
      "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "assert-plus": "^1.0.0",
 
        "jsprim": "^1.2.2",
 
        "sshpk": "^1.7.0"
 
      }
 
    },
 
    "image-size": {
 
      "version": "0.5.5",
 
      "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz",
 
      "integrity": "sha1-Cd/Uq50g4p6xw+gLiZA3jfnjy5w=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "inflight": {
 
      "version": "1.0.6",
 
      "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
 
      "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
 
      "dev": true,
 
      "requires": {
 
        "once": "^1.3.0",
 
        "wrappy": "1"
 
      }
 
    },
 
    "inherits": {
 
      "version": "2.0.4",
 
      "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
 
      "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
 
      "dev": true
 
    },
 
    "is-typedarray": {
 
      "version": "1.0.0",
 
      "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
 
      "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "isstream": {
 
      "version": "0.1.2",
 
      "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
 
      "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "jquery": {
 
      "version": "3.4.1",
 
      "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz",
 
      "integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw=="
 
    },
 
    "jquery.caret": {
 
      "version": "0.3.1",
 
      "resolved": "https://registry.npmjs.org/jquery.caret/-/jquery.caret-0.3.1.tgz",
 
      "integrity": "sha1-nAkzGPrzJ+/zIugmyp8yQTaLx7g="
 
    },
 
    "jquery.flot": {
 
      "version": "0.8.3",
 
      "resolved": "https://registry.npmjs.org/jquery.flot/-/jquery.flot-0.8.3.tgz",
 
      "integrity": "sha512-/tEE8J5NjwvStHDaCHkvTJpD7wDS4hE1OEL8xEmhgQfUe0gLUem923PIceNez1mz4yBNx6Hjv7pJcowLNd+nbg=="
 
    },
 
    "jsbn": {
 
      "version": "0.1.1",
 
      "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
 
      "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "json-parse-better-errors": {
 
      "version": "1.0.2",
 
      "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
 
      "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
 
      "dev": true
 
    },
 
    "json-schema": {
 
      "version": "0.2.3",
 
      "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
 
      "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "json-schema-traverse": {
 
      "version": "0.4.1",
 
      "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
 
      "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "json-stringify-safe": {
 
      "version": "5.0.1",
 
      "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
 
      "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "jsprim": {
 
      "version": "1.4.1",
 
      "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
 
      "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "assert-plus": "1.0.0",
 
        "extsprintf": "1.3.0",
 
        "json-schema": "0.2.3",
 
        "verror": "1.10.0"
 
      }
 
    },
 
    "less": {
 
      "version": "3.10.3",
 
      "resolved": "https://registry.npmjs.org/less/-/less-3.10.3.tgz",
 
      "integrity": "sha512-vz32vqfgmoxF1h3K4J+yKCtajH0PWmjkIFgbs5d78E/c/e+UQTnI+lWK+1eQRE95PXM2mC3rJlLSSP9VQHnaow==",
 
      "dev": true,
 
      "requires": {
 
        "clone": "^2.1.2",
 
        "errno": "^0.1.1",
 
        "graceful-fs": "^4.1.2",
 
        "image-size": "~0.5.0",
 
        "mime": "^1.4.1",
 
        "mkdirp": "^0.5.0",
 
        "promise": "^7.1.1",
 
        "request": "^2.83.0",
 
        "source-map": "~0.6.0"
 
      }
 
    },
 
    "less-plugin-clean-css": {
 
      "version": "1.5.1",
 
      "resolved": "https://registry.npmjs.org/less-plugin-clean-css/-/less-plugin-clean-css-1.5.1.tgz",
 
      "integrity": "sha1-zFeveqM5iVflbezr5jy2DCNClwM=",
 
      "dev": true,
 
      "requires": {
 
        "clean-css": "^3.0.1"
 
      }
 
    },
 
    "license-checker": {
 
      "version": "25.0.1",
 
      "resolved": "https://registry.npmjs.org/license-checker/-/license-checker-25.0.1.tgz",
 
      "integrity": "sha512-mET5AIwl7MR2IAKYYoVBBpV0OnkKQ1xGj2IMMeEFIs42QAkEVjRtFZGWmQ28WeU7MP779iAgOaOy93Mn44mn6g==",
 
      "dev": true,
 
      "requires": {
 
        "chalk": "^2.4.1",
 
        "debug": "^3.1.0",
 
        "mkdirp": "^0.5.1",
 
        "nopt": "^4.0.1",
 
        "read-installed": "~4.0.3",
 
        "semver": "^5.5.0",
 
        "spdx-correct": "^3.0.0",
 
        "spdx-expression-parse": "^3.0.0",
 
        "spdx-satisfies": "^4.0.0",
 
        "treeify": "^1.1.0"
 
      }
 
    },
 
    "mime": {
 
      "version": "1.6.0",
 
      "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
 
      "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "mime-db": {
 
      "version": "1.40.0",
 
      "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz",
 
      "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "mime-types": {
 
      "version": "2.1.24",
 
      "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz",
 
      "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "mime-db": "1.40.0"
 
      }
 
    },
 
    "minimatch": {
 
      "version": "3.0.4",
 
      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
 
      "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
 
      "dev": true,
 
      "requires": {
 
        "brace-expansion": "^1.1.7"
 
      }
 
    },
 
    "minimist": {
 
      "version": "0.0.8",
 
      "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
 
      "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
 
      "dev": true
 
    },
 
    "mkdirp": {
 
      "version": "0.5.1",
 
      "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
 
      "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
 
      "dev": true,
 
      "requires": {
 
        "minimist": "0.0.8"
 
      }
 
    },
 
    "ms": {
 
      "version": "2.1.2",
 
      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
 
      "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
 
      "dev": true
 
    },
 
    "nopt": {
 
      "version": "4.0.1",
 
      "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz",
 
      "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=",
 
      "dev": true,
 
      "requires": {
 
        "abbrev": "1",
 
        "osenv": "^0.1.4"
 
      }
 
    },
 
    "normalize-package-data": {
 
      "version": "2.5.0",
 
      "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
 
      "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==",
 
      "dev": true,
 
      "requires": {
 
        "hosted-git-info": "^2.1.4",
 
        "resolve": "^1.10.0",
 
        "semver": "2 || 3 || 4 || 5",
 
        "validate-npm-package-license": "^3.0.1"
 
      }
 
    },
 
    "oauth-sign": {
 
      "version": "0.9.0",
 
      "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
 
      "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "once": {
 
      "version": "1.4.0",
 
      "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
 
      "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
 
      "dev": true,
 
      "requires": {
 
        "wrappy": "1"
 
      }
 
    },
 
    "os-homedir": {
 
      "version": "1.0.2",
 
      "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
 
      "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
 
      "dev": true
 
    },
 
    "os-tmpdir": {
 
      "version": "1.0.2",
 
      "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
 
      "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
 
      "dev": true
 
    },
 
    "osenv": {
 
      "version": "0.1.5",
 
      "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz",
 
      "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",
 
      "dev": true,
 
      "requires": {
 
        "os-homedir": "^1.0.0",
 
        "os-tmpdir": "^1.0.0"
 
      }
 
    },
 
    "path-is-absolute": {
 
      "version": "1.0.1",
 
      "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
 
      "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
 
      "dev": true
 
    },
 
    "path-parse": {
 
      "version": "1.0.6",
 
      "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
 
      "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
 
      "dev": true
 
    },
 
    "performance-now": {
 
      "version": "2.1.0",
 
      "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
 
      "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "promise": {
 
      "version": "7.3.1",
 
      "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz",
 
      "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "asap": "~2.0.3"
 
      }
 
    },
 
    "prr": {
 
      "version": "1.0.1",
 
      "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
 
      "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "psl": {
 
      "version": "1.4.0",
 
      "resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz",
 
      "integrity": "sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw==",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "punycode": {
 
      "version": "2.1.1",
 
      "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
 
      "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "qs": {
 
      "version": "6.5.2",
 
      "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
 
      "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "read-installed": {
 
      "version": "4.0.3",
 
      "resolved": "https://registry.npmjs.org/read-installed/-/read-installed-4.0.3.tgz",
 
      "integrity": "sha1-/5uLZ/GH0eTCm5/rMfayI6zRkGc=",
 
      "dev": true,
 
      "requires": {
 
        "debuglog": "^1.0.1",
 
        "graceful-fs": "^4.1.2",
 
        "read-package-json": "^2.0.0",
 
        "readdir-scoped-modules": "^1.0.0",
 
        "semver": "2 || 3 || 4 || 5",
 
        "slide": "~1.1.3",
 
        "util-extend": "^1.0.1"
 
      }
 
    },
 
    "read-package-json": {
 
      "version": "2.1.0",
 
      "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-2.1.0.tgz",
 
      "integrity": "sha512-KLhu8M1ZZNkMcrq1+0UJbR8Dii8KZUqB0Sha4mOx/bknfKI/fyrQVrG/YIt2UOtG667sD8+ee4EXMM91W9dC+A==",
 
      "dev": true,
 
      "requires": {
 
        "glob": "^7.1.1",
 
        "graceful-fs": "^4.1.2",
 
        "json-parse-better-errors": "^1.0.1",
 
        "normalize-package-data": "^2.0.0",
 
        "slash": "^1.0.0"
 
      }
 
    },
 
    "readdir-scoped-modules": {
 
      "version": "1.1.0",
 
      "resolved": "https://registry.npmjs.org/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz",
 
      "integrity": "sha512-asaikDeqAQg7JifRsZn1NJZXo9E+VwlyCfbkZhwyISinqk5zNS6266HS5kah6P0SaQKGF6SkNnZVHUzHFYxYDw==",
 
      "dev": true,
 
      "requires": {
 
        "debuglog": "^1.0.1",
 
        "dezalgo": "^1.0.0",
 
        "graceful-fs": "^4.1.2",
 
        "once": "^1.3.0"
 
      }
 
    },
 
    "request": {
 
      "version": "2.88.0",
 
      "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz",
 
      "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "aws-sign2": "~0.7.0",
 
        "aws4": "^1.8.0",
 
        "caseless": "~0.12.0",
 
        "combined-stream": "~1.0.6",
 
        "extend": "~3.0.2",
 
        "forever-agent": "~0.6.1",
 
        "form-data": "~2.3.2",
 
        "har-validator": "~5.1.0",
 
        "http-signature": "~1.2.0",
 
        "is-typedarray": "~1.0.0",
 
        "isstream": "~0.1.2",
 
        "json-stringify-safe": "~5.0.1",
 
        "mime-types": "~2.1.19",
 
        "oauth-sign": "~0.9.0",
 
        "performance-now": "^2.1.0",
 
        "qs": "~6.5.2",
 
        "safe-buffer": "^5.1.2",
 
        "tough-cookie": "~2.4.3",
 
        "tunnel-agent": "^0.6.0",
 
        "uuid": "^3.3.2"
 
      }
 
    },
 
    "resolve": {
 
      "version": "1.12.0",
 
      "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz",
 
      "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==",
 
      "dev": true,
 
      "requires": {
 
        "path-parse": "^1.0.6"
 
      }
 
    },
 
    "safe-buffer": {
 
      "version": "5.2.0",
 
      "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
 
      "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "safer-buffer": {
 
      "version": "2.1.2",
 
      "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
 
      "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "select2": {
 
      "version": "3.5.1",
 
      "resolved": "https://registry.npmjs.org/select2/-/select2-3.5.1.tgz",
 
      "integrity": "sha1-8oGUibvGX9bTKL5yu+K5XdfofP4="
 
    },
 
    "select2-bootstrap-css": {
 
      "version": "1.4.6",
 
      "resolved": "https://registry.npmjs.org/select2-bootstrap-css/-/select2-bootstrap-css-1.4.6.tgz",
 
      "integrity": "sha1-XPtoJG9SmcoYWOAe/XiIBMc0mX4="
 
    },
 
    "semver": {
 
      "version": "5.7.1",
 
      "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
 
      "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
 
      "dev": true
 
    },
 
    "slash": {
 
      "version": "1.0.0",
 
      "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
 
      "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=",
 
      "dev": true
 
    },
 
    "slide": {
 
      "version": "1.1.6",
 
      "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz",
 
      "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=",
 
      "dev": true
 
    },
 
    "source-map": {
 
      "version": "0.6.1",
 
      "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
 
      "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "spdx-compare": {
 
      "version": "1.0.0",
 
      "resolved": "https://registry.npmjs.org/spdx-compare/-/spdx-compare-1.0.0.tgz",
 
      "integrity": "sha512-C1mDZOX0hnu0ep9dfmuoi03+eOdDoz2yvK79RxbcrVEG1NO1Ph35yW102DHWKN4pk80nwCgeMmSY5L25VE4D9A==",
 
      "dev": true,
 
      "requires": {
 
        "array-find-index": "^1.0.2",
 
        "spdx-expression-parse": "^3.0.0",
 
        "spdx-ranges": "^2.0.0"
 
      }
 
    },
 
    "spdx-correct": {
 
      "version": "3.1.0",
 
      "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz",
 
      "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==",
 
      "dev": true,
 
      "requires": {
 
        "spdx-expression-parse": "^3.0.0",
 
        "spdx-license-ids": "^3.0.0"
 
      }
 
    },
 
    "spdx-exceptions": {
 
      "version": "2.2.0",
 
      "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz",
 
      "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==",
 
      "dev": true
 
    },
 
    "spdx-expression-parse": {
 
      "version": "3.0.0",
 
      "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz",
 
      "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==",
 
      "dev": true,
 
      "requires": {
 
        "spdx-exceptions": "^2.1.0",
 
        "spdx-license-ids": "^3.0.0"
 
      }
 
    },
 
    "spdx-license-ids": {
 
      "version": "3.0.5",
 
      "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz",
 
      "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==",
 
      "dev": true
 
    },
 
    "spdx-ranges": {
 
      "version": "2.1.1",
 
      "resolved": "https://registry.npmjs.org/spdx-ranges/-/spdx-ranges-2.1.1.tgz",
 
      "integrity": "sha512-mcdpQFV7UDAgLpXEE/jOMqvK4LBoO0uTQg0uvXUewmEFhpiZx5yJSZITHB8w1ZahKdhfZqP5GPEOKLyEq5p8XA==",
 
      "dev": true
 
    },
 
    "spdx-satisfies": {
 
      "version": "4.0.1",
 
      "resolved": "https://registry.npmjs.org/spdx-satisfies/-/spdx-satisfies-4.0.1.tgz",
 
      "integrity": "sha512-WVzZ/cXAzoNmjCWiEluEA3BjHp5tiUmmhn9MK+X0tBbR9sOqtC6UQwmgCNrAIZvNlMuBUYAaHYfb2oqlF9SwKA==",
 
      "dev": true,
 
      "requires": {
 
        "spdx-compare": "^1.0.0",
 
        "spdx-expression-parse": "^3.0.0",
 
        "spdx-ranges": "^2.0.0"
 
      }
 
    },
 
    "sshpk": {
 
      "version": "1.16.1",
 
      "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
 
      "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "asn1": "~0.2.3",
 
        "assert-plus": "^1.0.0",
 
        "bcrypt-pbkdf": "^1.0.0",
 
        "dashdash": "^1.12.0",
 
        "ecc-jsbn": "~0.1.1",
 
        "getpass": "^0.1.1",
 
        "jsbn": "~0.1.0",
 
        "safer-buffer": "^2.0.2",
 
        "tweetnacl": "~0.14.0"
 
      }
 
    },
 
    "supports-color": {
 
      "version": "5.5.0",
 
      "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
 
      "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
 
      "dev": true,
 
      "requires": {
 
        "has-flag": "^3.0.0"
 
      }
 
    },
 
    "tough-cookie": {
 
      "version": "2.4.3",
 
      "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
 
      "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "psl": "^1.1.24",
 
        "punycode": "^1.4.1"
 
      },
 
      "dependencies": {
 
        "punycode": {
 
          "version": "1.4.1",
 
          "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
 
          "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=",
 
          "dev": true,
 
          "optional": true
 
        }
 
      }
 
    },
 
    "treeify": {
 
      "version": "1.1.0",
 
      "resolved": "https://registry.npmjs.org/treeify/-/treeify-1.1.0.tgz",
 
      "integrity": "sha512-1m4RA7xVAJrSGrrXGs0L3YTwyvBs2S8PbRHaLZAkFw7JR8oIFwYtysxlBZhYIa7xSyiYJKZ3iGrrk55cGA3i9A==",
 
      "dev": true
 
    },
 
    "tunnel-agent": {
 
      "version": "0.6.0",
 
      "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
 
      "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "safe-buffer": "^5.0.1"
 
      }
 
    },
 
    "tweetnacl": {
 
      "version": "0.14.5",
 
      "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
 
      "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "uri-js": {
 
      "version": "4.2.2",
 
      "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
 
      "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "punycode": "^2.1.0"
 
      }
 
    },
 
    "util-extend": {
 
      "version": "1.0.3",
 
      "resolved": "https://registry.npmjs.org/util-extend/-/util-extend-1.0.3.tgz",
 
      "integrity": "sha1-p8IW0mdUUWljeztu3GypEZ4v+T8=",
 
      "dev": true
 
    },
 
    "uuid": {
 
      "version": "3.3.3",
 
      "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
 
      "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==",
 
      "dev": true,
 
      "optional": true
 
    },
 
    "validate-npm-package-license": {
 
      "version": "3.0.4",
 
      "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
 
      "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
 
      "dev": true,
 
      "requires": {
 
        "spdx-correct": "^3.0.0",
 
        "spdx-expression-parse": "^3.0.0"
 
      }
 
    },
 
    "verror": {
 
      "version": "1.10.0",
 
      "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
 
      "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
 
      "dev": true,
 
      "optional": true,
 
      "requires": {
 
        "assert-plus": "^1.0.0",
 
        "core-util-is": "1.0.2",
 
        "extsprintf": "^1.2.0"
 
      }
 
    },
 
    "wrappy": {
 
      "version": "1.0.2",
 
      "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
 
      "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
 
      "dev": true
 
    }
 
  }
 
}
kallithea/front-end/package.json
Show inline comments
 
@@ -4,18 +4,18 @@
 
  "dependencies": {
 
    "at.js": "1.5.4",
 
    "bootstrap": "3.3.7",
 
    "codemirror": "4.7",
 
    "datatables.net": "1.10.13",
 
    "datatables.net-bs": "1.10.13",
 
    "jquery": "1.12.3",
 
    "codemirror": "5.49.0",
 
    "datatables.net": "1.10.20",
 
    "datatables.net-bs": "1.10.20",
 
    "jquery": "3.4.1",
 
    "jquery.caret": "0.3.1",
 
    "jquery.flot": "0.8.3",
 
    "select2": "3.5.1",
 
    "select2-bootstrap-css": "1.2.4"
 
    "select2-bootstrap-css": "1.4.6"
 
  },
 
  "devDependencies": {
 
    "less": "~2.7",
 
    "less-plugin-clean-css": "~1.5",
 
    "license-checker": "24.1.0"
 
    "less": "3.10.3",
 
    "less-plugin-clean-css": "1.5.1",
 
    "license-checker": "25.0.1"
 
  }
 
}

Changeset was too big and was cut off... Show full diff anyway

0 comments (0 inline, 0 general)