From 7216dd64ff15a4a642f2ffa4428590cb543766ed Mon Sep 17 00:00:00 2001 From: Marcin Kuzminski Date: Fri, 19 May 2017 10:33:10 +0200 Subject: [PATCH] audit-logs: introduced new view to replace admin journal. - audit logs will represent the all important actions made inside the system - raw view visible for super-admins --- rhodecode/apps/admin/__init__.py | 16 ++++ .../admin/tests/test_admin_audit_logs.py} | 83 +++++++++++-------- .../apps/admin/tests/test_admin_main_views.py | 82 ++++++++++++++++++ .../admin/views/audit_logs.py} | 60 +++++--------- rhodecode/apps/admin/views/main_views.py | 63 ++++++++++++++ rhodecode/apps/repository/__init__.py | 6 ++ rhodecode/config/routing.py | 16 ---- rhodecode/controllers/journal.py | 2 +- rhodecode/public/js/rhodecode/routes.js | 6 ++ .../{admin.mako => admin_audit_logs.mako} | 8 +- rhodecode/templates/admin/admin_log.mako | 15 ---- .../templates/admin/auth/auth_settings.mako | 2 +- .../templates/admin/auth/plugin_settings.mako | 2 +- .../templates/admin/defaults/defaults.mako | 2 +- .../templates/admin/integrations/base.mako | 2 +- .../templates/admin/integrations/form.mako | 4 +- .../templates/admin/integrations/list.mako | 4 +- .../templates/admin/integrations/new.mako | 4 +- .../admin/permissions/permissions.mako | 2 +- .../admin/repo_groups/repo_group_add.mako | 2 +- .../admin/repo_groups/repo_group_edit.mako | 2 +- .../admin/repo_groups/repo_groups.mako | 2 +- rhodecode/templates/admin/repos/repo_add.mako | 2 +- rhodecode/templates/admin/repos/repos.mako | 2 +- .../templates/admin/settings/settings.mako | 2 +- .../admin/user_groups/user_group_add.mako | 2 +- .../admin/user_groups/user_group_edit.mako | 2 +- .../admin/user_groups/user_groups.mako | 2 +- rhodecode/templates/admin/users/user_add.mako | 2 +- .../templates/admin/users/user_edit.mako | 2 +- rhodecode/templates/admin/users/users.mako | 2 +- rhodecode/templates/base/base.mako | 2 +- .../tests/functional/test_pullrequests.py | 13 --- 33 files changed, 272 insertions(+), 146 deletions(-) rename rhodecode/{tests/functional/test_admin.py => apps/admin/tests/test_admin_audit_logs.py} (64%) create mode 100644 rhodecode/apps/admin/tests/test_admin_main_views.py rename rhodecode/{controllers/admin/admin.py => apps/admin/views/audit_logs.py} (57%) create mode 100644 rhodecode/apps/admin/views/main_views.py rename rhodecode/templates/admin/{admin.mako => admin_audit_logs.mako} (78%) delete mode 100644 rhodecode/templates/admin/admin_log.mako diff --git a/rhodecode/apps/admin/__init__.py b/rhodecode/apps/admin/__init__.py index bd26edff..fbaf3fd6 100644 --- a/rhodecode/apps/admin/__init__.py +++ b/rhodecode/apps/admin/__init__.py @@ -29,6 +29,20 @@ def admin_routes(config): Admin prefixed routes """ + config.add_route( + name='admin_audit_logs', + pattern='/audit_logs') + + config.add_route( + name='pull_requests_global_0', # backward compat + pattern='/pull_requests/{pull_request_id:[0-9]+}') + config.add_route( + name='pull_requests_global_1', # backward compat + pattern='/pull-requests/{pull_request_id:[0-9]+}') + config.add_route( + name='pull_requests_global', + pattern='/pull-request/{pull_request_id:[0-9]+}') + config.add_route( name='admin_settings_open_source', pattern='/settings/open_source') @@ -93,6 +107,8 @@ def includeme(config): navigation_registry = NavigationRegistry(labs_active=labs_active) config.registry.registerUtility(navigation_registry) + # main admin routes + config.add_route(name='admin_home', pattern=ADMIN_PREFIX) config.include(admin_routes, route_prefix=ADMIN_PREFIX) # Scan module for configuration decorators. diff --git a/rhodecode/tests/functional/test_admin.py b/rhodecode/apps/admin/tests/test_admin_audit_logs.py similarity index 64% rename from rhodecode/tests/functional/test_admin.py rename to rhodecode/apps/admin/tests/test_admin_audit_logs.py index 0e68c763..6f14b285 100644 --- a/rhodecode/tests/functional/test_admin.py +++ b/rhodecode/apps/admin/tests/test_admin_audit_logs.py @@ -25,12 +25,25 @@ import datetime import pytest from rhodecode.tests import * +from rhodecode.tests.fixture import FIXTURES from rhodecode.model.db import UserLog from rhodecode.model.meta import Session from rhodecode.lib.utils2 import safe_unicode -dn = os.path.dirname -FIXTURES = os.path.join(dn(dn(os.path.abspath(__file__))), 'fixtures') + +def route_path(name, params=None, **kwargs): + import urllib + from rhodecode.apps._base import ADMIN_PREFIX + + base_url = { + 'admin_home': ADMIN_PREFIX, + 'admin_audit_logs': ADMIN_PREFIX + '/audit_logs', + + }[name].format(**kwargs) + + if params: + base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + return base_url class TestAdminController(TestController): @@ -73,102 +86,102 @@ class TestAdminController(TestController): def test_index(self): self.log_user() - response = self.app.get(url(controller='admin/admin', action='index')) - response.mustcontain('Admin journal') + response = self.app.get(route_path('admin_audit_logs')) + response.mustcontain('Admin audit logs') def test_filter_all_entries(self): self.log_user() - response = self.app.get(url(controller='admin/admin', action='index',)) + response = self.app.get(route_path('admin_audit_logs')) all_count = UserLog.query().count() response.mustcontain('%s entries' % all_count) def test_filter_journal_filter_exact_match_on_repository(self): self.log_user() - response = self.app.get(url(controller='admin/admin', action='index', - filter='repository:rhodecode')) + response = self.app.get(route_path('admin_audit_logs', + params=dict(filter='repository:rhodecode'))) response.mustcontain('3 entries') def test_filter_journal_filter_exact_match_on_repository_CamelCase(self): self.log_user() - response = self.app.get(url(controller='admin/admin', action='index', - filter='repository:RhodeCode')) + response = self.app.get(route_path('admin_audit_logs', + params=dict(filter='repository:RhodeCode'))) response.mustcontain('3 entries') def test_filter_journal_filter_wildcard_on_repository(self): self.log_user() - response = self.app.get(url(controller='admin/admin', action='index', - filter='repository:*test*')) + response = self.app.get(route_path('admin_audit_logs', + params=dict(filter='repository:*test*'))) response.mustcontain('862 entries') def test_filter_journal_filter_prefix_on_repository(self): self.log_user() - response = self.app.get(url(controller='admin/admin', action='index', - filter='repository:test*')) + response = self.app.get(route_path('admin_audit_logs', + params=dict(filter='repository:test*'))) response.mustcontain('257 entries') def test_filter_journal_filter_prefix_on_repository_CamelCase(self): self.log_user() - response = self.app.get(url(controller='admin/admin', action='index', - filter='repository:Test*')) + response = self.app.get(route_path('admin_audit_logs', + params=dict(filter='repository:Test*'))) response.mustcontain('257 entries') def test_filter_journal_filter_prefix_on_repository_and_user(self): self.log_user() - response = self.app.get(url(controller='admin/admin', action='index', - filter='repository:test* AND username:demo')) + response = self.app.get(route_path('admin_audit_logs', + params=dict(filter='repository:test* AND username:demo'))) response.mustcontain('130 entries') def test_filter_journal_filter_prefix_on_repository_or_target_repo(self): self.log_user() - response = self.app.get(url(controller='admin/admin', action='index', - filter='repository:test* OR repository:rhodecode')) + response = self.app.get(route_path('admin_audit_logs', + params=dict(filter='repository:test* OR repository:rhodecode'))) response.mustcontain('260 entries') # 257 + 3 def test_filter_journal_filter_exact_match_on_username(self): self.log_user() - response = self.app.get(url(controller='admin/admin', action='index', - filter='username:demo')) + response = self.app.get(route_path('admin_audit_logs', + params=dict(filter='username:demo'))) response.mustcontain('1087 entries') def test_filter_journal_filter_exact_match_on_username_camelCase(self): self.log_user() - response = self.app.get(url(controller='admin/admin', action='index', - filter='username:DemO')) + response = self.app.get(route_path('admin_audit_logs', + params=dict(filter='username:DemO'))) response.mustcontain('1087 entries') def test_filter_journal_filter_wildcard_on_username(self): self.log_user() - response = self.app.get(url(controller='admin/admin', action='index', - filter='username:*test*')) + response = self.app.get(route_path('admin_audit_logs', + params=dict(filter='username:*test*'))) entries_count = UserLog.query().filter(UserLog.username.ilike('%test%')).count() response.mustcontain('{} entries'.format(entries_count)) def test_filter_journal_filter_prefix_on_username(self): self.log_user() - response = self.app.get(url(controller='admin/admin', action='index', - filter='username:demo*')) + response = self.app.get(route_path('admin_audit_logs', + params=dict(filter='username:demo*'))) response.mustcontain('1101 entries') def test_filter_journal_filter_prefix_on_user_or_other_user(self): self.log_user() - response = self.app.get(url(controller='admin/admin', action='index', - filter='username:demo OR username:volcan')) + response = self.app.get(route_path('admin_audit_logs', + params=dict(filter='username:demo OR username:volcan'))) response.mustcontain('1095 entries') # 1087 + 8 def test_filter_journal_filter_wildcard_on_action(self): self.log_user() - response = self.app.get(url(controller='admin/admin', action='index', - filter='action:*pull_request*')) + response = self.app.get(route_path('admin_audit_logs', + params=dict(filter='action:*pull_request*'))) response.mustcontain('187 entries') def test_filter_journal_filter_on_date(self): self.log_user() - response = self.app.get(url(controller='admin/admin', action='index', - filter='date:20121010')) + response = self.app.get(route_path('admin_audit_logs', + params=dict(filter='date:20121010'))) response.mustcontain('47 entries') def test_filter_journal_filter_on_date_2(self): self.log_user() - response = self.app.get(url(controller='admin/admin', action='index', - filter='date:20121020')) + response = self.app.get(route_path('admin_audit_logs', + params=dict(filter='date:20121020'))) response.mustcontain('17 entries') diff --git a/rhodecode/apps/admin/tests/test_admin_main_views.py b/rhodecode/apps/admin/tests/test_admin_main_views.py new file mode 100644 index 00000000..1727b625 --- /dev/null +++ b/rhodecode/apps/admin/tests/test_admin_main_views.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +# Copyright (C) 2010-2017 RhodeCode GmbH +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License, version 3 +# (only), as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# This program is dual-licensed. If you wish to learn more about the +# RhodeCode Enterprise Edition, including its added features, Support services, +# and proprietary license terms, please see https://rhodecode.com/licenses/ + +import pytest + +from rhodecode.tests import TestController +from rhodecode.tests.fixture import Fixture + +fixture = Fixture() + + +def route_path(name, params=None, **kwargs): + import urllib + from rhodecode.apps._base import ADMIN_PREFIX + + base_url = { + 'admin_home': ADMIN_PREFIX, + 'pullrequest_show': '/{repo_name}/pull-request/{pull_request_id}', + 'pull_requests_global': ADMIN_PREFIX + '/pull-request/{pull_request_id}', + 'pull_requests_global_0': ADMIN_PREFIX + '/pull_requests/{pull_request_id}', + 'pull_requests_global_1': ADMIN_PREFIX + '/pull-requests/{pull_request_id}', + + }[name].format(**kwargs) + + if params: + base_url = '{}?{}'.format(base_url, urllib.urlencode(params)) + return base_url + + +class TestAdminMainView(TestController): + + def test_redirect_admin_home(self): + self.log_user() + response = self.app.get(route_path('admin_home'), status=302) + assert response.location.endswith('/audit_logs') + + def test_redirect_pull_request_view(self, view): + self.log_user() + self.app.get( + route_path(view, pull_request_id='xxxx'), + status=404) + + @pytest.mark.backends("git", "hg") + @pytest.mark.parametrize('view', [ + 'pull_requests_global', + 'pull_requests_global_0', + 'pull_requests_global_1', + ]) + def test_redirect_pull_request_view(self, view, pr_util): + self.log_user() + pull_request = pr_util.create_pull_request() + pull_request_id = pull_request.pull_request_id + + response = self.app.get( + route_path(view, pull_request_id=pull_request_id), + status=302) + assert response.location.endswith( + 'pull-request/{}'.format(pull_request_id)) + + repo_name = pull_request.target_repo.repo_name + redirect_url = route_path( + 'pullrequest_show', repo_name=repo_name, + pull_request_id=pull_request.pull_request_id) + + assert redirect_url in response.location diff --git a/rhodecode/controllers/admin/admin.py b/rhodecode/apps/admin/views/audit_logs.py similarity index 57% rename from rhodecode/controllers/admin/admin.py rename to rhodecode/apps/admin/views/audit_logs.py index bbaa8dad..1ee6cf1c 100644 --- a/rhodecode/controllers/admin/admin.py +++ b/rhodecode/apps/admin/views/audit_logs.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2010-2017 RhodeCode GmbH +# Copyright (C) 2016-2017 RhodeCode GmbH # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License, version 3 @@ -18,42 +18,41 @@ # RhodeCode Enterprise Edition, including its added features, Support services, # and proprietary license terms, please see https://rhodecode.com/licenses/ -""" -Controller for Admin panel of RhodeCode Enterprise -""" - - import logging -from pylons import request, tmpl_context as c, url -from pylons.controllers.util import redirect +from pyramid.view import view_config from sqlalchemy.orm import joinedload -from rhodecode.model.db import UserLog, PullRequest +from rhodecode.apps._base import BaseAppView +from rhodecode.model.db import UserLog from rhodecode.lib.user_log_filter import user_log_filter from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator -from rhodecode.lib.base import BaseController, render from rhodecode.lib.utils2 import safe_int from rhodecode.lib.helpers import Page - log = logging.getLogger(__name__) -class AdminController(BaseController): +class AdminAuditLogsView(BaseAppView): + def load_default_context(self): + c = self._get_local_tmpl_context() + self._register_global_c(c) + return c @LoginRequired() - def __before__(self): - super(AdminController, self).__before__() - @HasPermissionAllDecorator('hg.admin') - def index(self): + @view_config( + route_name='admin_audit_logs', request_method='GET', + renderer='rhodecode:templates/admin/admin_audit_logs.mako') + def admin_audit_logs(self): + c = self.load_default_context() + users_log = UserLog.query()\ .options(joinedload(UserLog.user))\ .options(joinedload(UserLog.repository)) # FILTERING - c.search_term = request.GET.get('filter') + c.search_term = self.request.GET.get('filter') try: users_log = user_log_filter(users_log, c.search_term) except Exception: @@ -62,28 +61,13 @@ class AdminController(BaseController): users_log = users_log.order_by(UserLog.action_date.desc()) - p = safe_int(request.GET.get('page', 1), 1) + p = safe_int(self.request.GET.get('page', 1), 1) def url_generator(**kw): - return url.current(filter=c.search_term, **kw) + if c.search_term: + kw['filter'] = c.search_term + return self.request.current_route_path(_query=kw) c.audit_logs = Page(users_log, page=p, items_per_page=10, - url=url_generator) - c.log_data = render('admin/admin_log.mako') - - if request.is_xhr: - return c.log_data - return render('admin/admin.mako') - - # global redirect doesn't need permissions - def pull_requests(self, pull_request_id): - """ - Global redirect for Pull Requests - - :param pull_request_id: id of pull requests in the system - """ - pull_request = PullRequest.get_or_404(pull_request_id) - repo_name = pull_request.target_repo.repo_name - return redirect(url( - 'pullrequest_show', repo_name=repo_name, - pull_request_id=pull_request_id)) + url=url_generator) + return self._get_template_context(c) diff --git a/rhodecode/apps/admin/views/main_views.py b/rhodecode/apps/admin/views/main_views.py new file mode 100644 index 00000000..6c014c4d --- /dev/null +++ b/rhodecode/apps/admin/views/main_views.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- + +# Copyright (C) 2016-2017 RhodeCode GmbH +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License, version 3 +# (only), as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +# This program is dual-licensed. If you wish to learn more about the +# RhodeCode Enterprise Edition, including its added features, Support services, +# and proprietary license terms, please see https://rhodecode.com/licenses/ + +import logging + + +from pyramid.httpexceptions import HTTPFound +from pyramid.view import view_config + +from rhodecode.apps._base import BaseAppView +from rhodecode.lib import helpers as h +from rhodecode.lib.auth import (LoginRequired, HasPermissionAllDecorator) +from rhodecode.model.db import PullRequest + + +log = logging.getLogger(__name__) + + +class AdminMainView(BaseAppView): + + @LoginRequired() + @HasPermissionAllDecorator('hg.admin') + @view_config( + route_name='admin_home', request_method='GET') + def admin_main(self): + # redirect _admin to audit logs... + raise HTTPFound(h.route_path('admin_audit_logs')) + + @LoginRequired() + @view_config(route_name='pull_requests_global_0', request_method='GET') + @view_config(route_name='pull_requests_global_1', request_method='GET') + @view_config(route_name='pull_requests_global', request_method='GET') + def pull_requests(self): + """ + Global redirect for Pull Requests + + :param pull_request_id: id of pull requests in the system + """ + + pull_request_id = self.request.matchdict.get('pull_request_id') + pull_request = PullRequest.get_or_404(pull_request_id, pyramid_exc=True) + repo_name = pull_request.target_repo.repo_name + + raise HTTPFound( + h.route_path('pullrequest_show', repo_name=repo_name, + pull_request_id=pull_request_id)) diff --git a/rhodecode/apps/repository/__init__.py b/rhodecode/apps/repository/__init__.py index 9f9bb5ab..8719555c 100644 --- a/rhodecode/apps/repository/__init__.py +++ b/rhodecode/apps/repository/__init__.py @@ -41,6 +41,12 @@ def includeme(config): name='bookmarks_home', pattern='/{repo_name:.*?[^/]}/bookmarks', repo_route=True) + # Pull Requests + config.add_route( + name='pullrequest_show', + pattern='/{repo_name:.*?[^/]}/pull-request/{pull_request_id}', + repo_route=True) + # Settings config.add_route( name='edit_repo', diff --git a/rhodecode/config/routing.py b/rhodecode/config/routing.py index 6340201d..6cc70d76 100644 --- a/rhodecode/config/routing.py +++ b/rhodecode/config/routing.py @@ -561,22 +561,6 @@ def make_map(config): action='show', conditions={'method': ['GET']}, requirements=URL_NAME_REQUIREMENTS) - # ADMIN MAIN PAGES - 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\. _-]*}', - action='add_repo') - m.connect( - 'pull_requests_global_0', '/pull_requests/{pull_request_id:[0-9]+}', - action='pull_requests') - m.connect( - 'pull_requests_global_1', '/pull-requests/{pull_request_id:[0-9]+}', - action='pull_requests') - m.connect( - 'pull_requests_global', '/pull-request/{pull_request_id:[0-9]+}', - action='pull_requests') - # USER JOURNAL rmap.connect('journal', '%s/journal' % (ADMIN_PREFIX,), controller='journal', action='index') diff --git a/rhodecode/controllers/journal.py b/rhodecode/controllers/journal.py index f49c1fa3..a88a355b 100644 --- a/rhodecode/controllers/journal.py +++ b/rhodecode/controllers/journal.py @@ -34,11 +34,11 @@ from webob.exc import HTTPBadRequest from pylons import request, tmpl_context as c, response, url from pylons.i18n.translation import _ -from rhodecode.controllers.admin.admin import user_log_filter from rhodecode.model.db import UserLog, UserFollowing, User, UserApiKeys from rhodecode.model.meta import Session import rhodecode.lib.helpers as h from rhodecode.lib.helpers import Page +from rhodecode.lib.user_log_filter import user_log_filter from rhodecode.lib.auth import LoginRequired, NotAnonymous, CSRFRequired from rhodecode.lib.base import BaseController, render from rhodecode.lib.utils2 import safe_int, AttributeDict diff --git a/rhodecode/public/js/rhodecode/routes.js b/rhodecode/public/js/rhodecode/routes.js index 35b383c5..aa8e98de 100644 --- a/rhodecode/public/js/rhodecode/routes.js +++ b/rhodecode/public/js/rhodecode/routes.js @@ -69,6 +69,11 @@ function registerRCRoutes() { pyroutes.register('repo_integrations_create', '%(repo_name)s/settings/integrations/%(integration)s/new', ['repo_name', 'integration']); pyroutes.register('repo_integrations_edit', '%(repo_name)s/settings/integrations/%(integration)s/%(integration_id)s', ['repo_name', 'integration', 'integration_id']); pyroutes.register('ops_ping', '_admin/ops/ping', []); + pyroutes.register('admin_home', '/_admin', []); + pyroutes.register('admin_audit_logs', '_admin/audit_logs', []); + pyroutes.register('pull_requests_global_0', '_admin/pull_requests/%(pull_request_id)s', ['pull_request_id']); + pyroutes.register('pull_requests_global_1', '_admin/pull-requests/%(pull_request_id)s', ['pull_request_id']); + pyroutes.register('pull_requests_global', '_admin/pull-request/%(pull_request_id)s', ['pull_request_id']); pyroutes.register('admin_settings_open_source', '_admin/settings/open_source', []); pyroutes.register('admin_settings_vcs_svn_generate_cfg', '_admin/settings/vcs/svn_generate_cfg', []); pyroutes.register('admin_settings_system', '_admin/settings/system', []); @@ -100,6 +105,7 @@ function registerRCRoutes() { pyroutes.register('tags_home', '/%(repo_name)s/tags', ['repo_name']); pyroutes.register('branches_home', '/%(repo_name)s/branches', ['repo_name']); pyroutes.register('bookmarks_home', '/%(repo_name)s/bookmarks', ['repo_name']); + pyroutes.register('pullrequest_show', '/%(repo_name)s/pull-request/%(pull_request_id)s', ['repo_name', 'pull_request_id']); pyroutes.register('edit_repo', '/%(repo_name)s/settings', ['repo_name']); pyroutes.register('edit_repo_advanced', '/%(repo_name)s/settings/advanced', ['repo_name']); pyroutes.register('edit_repo_advanced_delete', '/%(repo_name)s/settings/advanced/delete', ['repo_name']); diff --git a/rhodecode/templates/admin/admin.mako b/rhodecode/templates/admin/admin_audit_logs.mako similarity index 78% rename from rhodecode/templates/admin/admin.mako rename to rhodecode/templates/admin/admin_audit_logs.mako index eea33dad..6886ccae 100644 --- a/rhodecode/templates/admin/admin.mako +++ b/rhodecode/templates/admin/admin_audit_logs.mako @@ -2,7 +2,7 @@ <%inherit file="/base/base.mako"/> <%def name="title()"> - ${_('Admin journal')} + ${_('Admin audit logs')} %if c.rhodecode_name: · ${h.branding(c.rhodecode_name)} %endif @@ -10,9 +10,9 @@ <%def name="breadcrumbs_links()"> ${h.form(None, id_="filter_form", method="get")} - + - ${_('Admin journal')} - ${ungettext('%s entry', '%s entries', c.audit_logs.item_count) % (c.audit_logs.item_count)} + ${_('Audit logs')} - ${_ungettext('%s entry', '%s entries', c.audit_logs.item_count) % (c.audit_logs.item_count)} ${h.end_form()}

${_('Example Queries')}

@@ -29,7 +29,7 @@
- ${c.log_data} + <%include file="/admin/admin_log_base.mako" />
diff --git a/rhodecode/templates/admin/admin_log.mako b/rhodecode/templates/admin/admin_log.mako deleted file mode 100644 index 02be0e1c..00000000 --- a/rhodecode/templates/admin/admin_log.mako +++ /dev/null @@ -1,15 +0,0 @@ -## -*- coding: utf-8 -*- -<%include file="/admin/admin_log_base.mako" /> - - - diff --git a/rhodecode/templates/admin/auth/auth_settings.mako b/rhodecode/templates/admin/auth/auth_settings.mako index d9c767b4..9ccdebaa 100644 --- a/rhodecode/templates/admin/auth/auth_settings.mako +++ b/rhodecode/templates/admin/auth/auth_settings.mako @@ -9,7 +9,7 @@ <%def name="breadcrumbs_links()"> - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${_('Authentication Plugins')} diff --git a/rhodecode/templates/admin/auth/plugin_settings.mako b/rhodecode/templates/admin/auth/plugin_settings.mako index ec37a790..6a84a57a 100644 --- a/rhodecode/templates/admin/auth/plugin_settings.mako +++ b/rhodecode/templates/admin/auth/plugin_settings.mako @@ -9,7 +9,7 @@ <%def name="breadcrumbs_links()"> - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${h.link_to(_('Authentication Plugins'),request.resource_path(resource.__parent__, route_name='auth_home'))} » diff --git a/rhodecode/templates/admin/defaults/defaults.mako b/rhodecode/templates/admin/defaults/defaults.mako index 8f47e695..78aa88ef 100644 --- a/rhodecode/templates/admin/defaults/defaults.mako +++ b/rhodecode/templates/admin/defaults/defaults.mako @@ -9,7 +9,7 @@ <%def name="breadcrumbs_links()"> - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${_('Repositories defaults')} diff --git a/rhodecode/templates/admin/integrations/base.mako b/rhodecode/templates/admin/integrations/base.mako index 5db47c2c..6b5506a9 100644 --- a/rhodecode/templates/admin/integrations/base.mako +++ b/rhodecode/templates/admin/integrations/base.mako @@ -18,7 +18,7 @@ <%def name="breadcrumbs_links()"> - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${_('Integrations')} diff --git a/rhodecode/templates/admin/integrations/form.mako b/rhodecode/templates/admin/integrations/form.mako index a64b4a5f..a57f0c05 100644 --- a/rhodecode/templates/admin/integrations/form.mako +++ b/rhodecode/templates/admin/integrations/form.mako @@ -12,7 +12,7 @@ repo_name=c.repo.repo_name, integration=current_IntegrationType.key))} %elif c.repo_group: - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${h.link_to(_('Repository Groups'),h.url('repo_groups'))} » @@ -25,7 +25,7 @@ repo_group_name=c.repo_group.group_name, integration=current_IntegrationType.key))} %else: - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${h.link_to(_('Settings'),h.url('admin_settings'))} » diff --git a/rhodecode/templates/admin/integrations/list.mako b/rhodecode/templates/admin/integrations/list.mako index 80beef2b..8a9bb1cd 100644 --- a/rhodecode/templates/admin/integrations/list.mako +++ b/rhodecode/templates/admin/integrations/list.mako @@ -5,13 +5,13 @@ %if c.repo: ${h.link_to('Settings',h.route_path('edit_repo', repo_name=c.repo.repo_name))} %elif c.repo_group: - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${h.link_to(_('Repository Groups'),h.url('repo_groups'))} » ${h.link_to(c.repo_group.group_name,h.url('edit_repo_group', group_name=c.repo_group.group_name))} %else: - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${h.link_to(_('Settings'),h.url('admin_settings'))} %endif diff --git a/rhodecode/templates/admin/integrations/new.mako b/rhodecode/templates/admin/integrations/new.mako index fa53a42f..65a2ed8f 100644 --- a/rhodecode/templates/admin/integrations/new.mako +++ b/rhodecode/templates/admin/integrations/new.mako @@ -8,7 +8,7 @@ » ${h.link_to(_('Integrations'),request.route_url(route_name='repo_integrations_home', repo_name=c.repo.repo_name))} %elif c.repo_group: - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${h.link_to(_('Repository Groups'),h.url('repo_groups'))} » @@ -16,7 +16,7 @@ » ${h.link_to(_('Integrations'),request.route_url(route_name='repo_group_integrations_home', repo_group_name=c.repo_group.group_name))} %else: - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${h.link_to(_('Settings'),h.url('admin_settings'))} » diff --git a/rhodecode/templates/admin/permissions/permissions.mako b/rhodecode/templates/admin/permissions/permissions.mako index 4afa7312..d96ecb93 100644 --- a/rhodecode/templates/admin/permissions/permissions.mako +++ b/rhodecode/templates/admin/permissions/permissions.mako @@ -9,7 +9,7 @@ <%def name="breadcrumbs_links()"> - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${_('Permissions')} diff --git a/rhodecode/templates/admin/repo_groups/repo_group_add.mako b/rhodecode/templates/admin/repo_groups/repo_group_add.mako index 7bfe230c..82f836b7 100644 --- a/rhodecode/templates/admin/repo_groups/repo_group_add.mako +++ b/rhodecode/templates/admin/repo_groups/repo_group_add.mako @@ -9,7 +9,7 @@ <%def name="breadcrumbs_links()"> - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${h.link_to(_('Repository groups'),h.url('repo_groups'))} » diff --git a/rhodecode/templates/admin/repo_groups/repo_group_edit.mako b/rhodecode/templates/admin/repo_groups/repo_group_edit.mako index 141252d7..26ef6803 100644 --- a/rhodecode/templates/admin/repo_groups/repo_group_edit.mako +++ b/rhodecode/templates/admin/repo_groups/repo_group_edit.mako @@ -9,7 +9,7 @@ <%def name="breadcrumbs_links()"> - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${h.link_to(_('Repository Groups'),h.url('repo_groups'))} %if c.repo_group.parent_group: diff --git a/rhodecode/templates/admin/repo_groups/repo_groups.mako b/rhodecode/templates/admin/repo_groups/repo_groups.mako index d0cea57a..6e998c6a 100644 --- a/rhodecode/templates/admin/repo_groups/repo_groups.mako +++ b/rhodecode/templates/admin/repo_groups/repo_groups.mako @@ -10,7 +10,7 @@ <%def name="breadcrumbs_links()"> - ${h.link_to(_('Admin'),h.url('admin_home'))} » 0 ${_('repository groups')} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » 0 ${_('repository groups')} <%def name="menu_bar_nav()"> diff --git a/rhodecode/templates/admin/repos/repo_add.mako b/rhodecode/templates/admin/repos/repo_add.mako index 868f27a8..3ec71cbb 100644 --- a/rhodecode/templates/admin/repos/repo_add.mako +++ b/rhodecode/templates/admin/repos/repo_add.mako @@ -10,7 +10,7 @@ <%def name="breadcrumbs_links()"> %if c.rhodecode_user.is_admin: - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${h.link_to(_('Repositories'),h.url('repos'))} %else: diff --git a/rhodecode/templates/admin/repos/repos.mako b/rhodecode/templates/admin/repos/repos.mako index ce06b6b5..01debfae 100644 --- a/rhodecode/templates/admin/repos/repos.mako +++ b/rhodecode/templates/admin/repos/repos.mako @@ -10,7 +10,7 @@ <%def name="breadcrumbs_links()"> - ${h.link_to(_('Admin'),h.url('admin_home'))} » 0 ${_('repositories')} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » 0 ${_('repositories')} <%def name="menu_bar_nav()"> diff --git a/rhodecode/templates/admin/settings/settings.mako b/rhodecode/templates/admin/settings/settings.mako index 071133e7..a136daa8 100644 --- a/rhodecode/templates/admin/settings/settings.mako +++ b/rhodecode/templates/admin/settings/settings.mako @@ -9,7 +9,7 @@ <%def name="breadcrumbs_links()"> - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${_('Settings')} diff --git a/rhodecode/templates/admin/user_groups/user_group_add.mako b/rhodecode/templates/admin/user_groups/user_group_add.mako index b198e2de..e404d60e 100644 --- a/rhodecode/templates/admin/user_groups/user_group_add.mako +++ b/rhodecode/templates/admin/user_groups/user_group_add.mako @@ -8,7 +8,7 @@ %endif <%def name="breadcrumbs_links()"> - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${h.link_to(_('User groups'),h.url('users_groups'))} » diff --git a/rhodecode/templates/admin/user_groups/user_group_edit.mako b/rhodecode/templates/admin/user_groups/user_group_edit.mako index e912b0ec..fb28b8d5 100644 --- a/rhodecode/templates/admin/user_groups/user_group_edit.mako +++ b/rhodecode/templates/admin/user_groups/user_group_edit.mako @@ -9,7 +9,7 @@ <%def name="breadcrumbs_links()"> - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${h.link_to(_('User Groups'),h.url('users_groups'))} » diff --git a/rhodecode/templates/admin/user_groups/user_groups.mako b/rhodecode/templates/admin/user_groups/user_groups.mako index 441e8234..5b9709bf 100644 --- a/rhodecode/templates/admin/user_groups/user_groups.mako +++ b/rhodecode/templates/admin/user_groups/user_groups.mako @@ -10,7 +10,7 @@ <%def name="breadcrumbs_links()"> - ${h.link_to(_('Admin'),h.url('admin_home'))} » 0 ${_('user groups')} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » 0 ${_('user groups')} <%def name="menu_bar_nav()"> diff --git a/rhodecode/templates/admin/users/user_add.mako b/rhodecode/templates/admin/users/user_add.mako index 21525aad..2d3e83f0 100644 --- a/rhodecode/templates/admin/users/user_add.mako +++ b/rhodecode/templates/admin/users/user_add.mako @@ -8,7 +8,7 @@ %endif <%def name="breadcrumbs_links()"> - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${h.link_to(_('Users'),h.route_path('users'))} » diff --git a/rhodecode/templates/admin/users/user_edit.mako b/rhodecode/templates/admin/users/user_edit.mako index d8be135b..c12b7fdf 100644 --- a/rhodecode/templates/admin/users/user_edit.mako +++ b/rhodecode/templates/admin/users/user_edit.mako @@ -9,7 +9,7 @@ <%def name="breadcrumbs_links()"> - ${h.link_to(_('Admin'),h.url('admin_home'))} + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » ${h.link_to(_('Users'),h.route_path('users'))} » diff --git a/rhodecode/templates/admin/users/users.mako b/rhodecode/templates/admin/users/users.mako index 58575eb9..d526f912 100644 --- a/rhodecode/templates/admin/users/users.mako +++ b/rhodecode/templates/admin/users/users.mako @@ -10,7 +10,7 @@ <%def name="breadcrumbs_links()"> - ${h.link_to(_('Admin'),h.url('admin_home'))} » 0 + ${h.link_to(_('Admin'),h.route_path('admin_home'))} » 0 <%def name="menu_bar_nav()"> diff --git a/rhodecode/templates/base/base.mako b/rhodecode/templates/base/base.mako index 7035c82a..256790e3 100644 --- a/rhodecode/templates/base/base.mako +++ b/rhodecode/templates/base/base.mako @@ -72,7 +72,7 @@ <%def name="admin_menu()">