# HG changeset patch # User Andrii Verbytskyi # Date 2024-09-11 08:10:02 # Node ID 3cd45018a1d9d2e2c6984eb8f1aaa8af524d0c0d # Parent 6d578f95df0e5d7b08db6cc6f3b2e772f27bea67 feat: security tab in admin, routes and placeholder view for ee functionality diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -54,7 +54,7 @@ syntax: regexp ^rhodecode\.log$ ^rhodecode_dev\.log$ ^test\.db$ - +^venv/ # ac-tests ^acceptance_tests/\.cache.*$ diff --git a/rhodecode/apps/admin/__init__.py b/rhodecode/apps/admin/__init__.py --- a/rhodecode/apps/admin/__init__.py +++ b/rhodecode/apps/admin/__init__.py @@ -43,7 +43,29 @@ def admin_routes(config): from rhodecode.apps.admin.views.system_info import AdminSystemInfoSettingsView from rhodecode.apps.admin.views.user_groups import AdminUserGroupsView from rhodecode.apps.admin.views.users import AdminUsersView, UsersView - + from rhodecode.apps.admin.views.security import AdminSecurityView + + # Security EE feature + + config.add_route( + 'admin_security', + pattern=ADMIN_PREFIX + '/security') + config.add_view( + AdminSecurityView, + attr='security' , + route_name='admin_security', request_method='GET', + renderer='rhodecode:templates/admin/security/security.mako') + + config.add_route( + name='admin_security_update', + pattern=ADMIN_PREFIX + '/security/update') + config.add_view( + AdminSecurityView, + attr='security_update', + route_name='admin_security_update', request_method='POST', + renderer='rhodecode:templates/admin/security/security.mako') + + config.add_route( name='admin_audit_logs', pattern='/audit_logs') diff --git a/rhodecode/apps/admin/views/security.py b/rhodecode/apps/admin/views/security.py new file mode 100644 --- /dev/null +++ b/rhodecode/apps/admin/views/security.py @@ -0,0 +1,39 @@ +# Copyright (C) 2010-2024 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 rhodecode.apps._base import BaseAppView +from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator + +log = logging.getLogger(__name__) + + +class AdminSecurityView(BaseAppView): + + def load_default_context(self): + c = self._get_local_tmpl_context() + return c + + @LoginRequired() + @HasPermissionAllDecorator('hg.admin') + def security(self): + c = self.load_default_context() + c.active = 'security' + return self._get_template_context(c) + diff --git a/rhodecode/templates/admin/security/security.mako b/rhodecode/templates/admin/security/security.mako new file mode 100644 --- /dev/null +++ b/rhodecode/templates/admin/security/security.mako @@ -0,0 +1,40 @@ +<%inherit file="/base/base.mako"/> + +<%def name="title()"> + ${_('Security Admin')} + %if c.rhodecode_name: + · ${h.branding(c.rhodecode_name)} + %endif + + +<%def name="breadcrumbs_links()"> + +<%def name="menu_bar_nav()"> + ${self.menu_items(active='admin')} + + +<%def name="menu_bar_subnav()"> + ${self.admin_menu(active='security')} + + +<%def name="main()"> + +
+ +
+
+

${_('Security Audit')}

+
+
+

${_('This feature is available in RhodeCode EE edition only. Contact {sales_email} to obtain a trial license.').format(sales_email='sales@rhodecode.com')|n}

+

+ You can scan your repositories for exposed secrets, passwords, etc +

+
+
+ +
+ + + + diff --git a/rhodecode/templates/base/base.mako b/rhodecode/templates/base/base.mako --- a/rhodecode/templates/base/base.mako +++ b/rhodecode/templates/base/base.mako @@ -114,6 +114,7 @@
  • ${_('Repository groups')}
  • ${_('Users')}
  • ${_('User groups')}
  • +
  • ${_('Security')}
  • ${_('Artifacts')}
  • ${_('Automation')}
  • ${_('Scheduler')}