diff --git a/apps/authentication/urls/view_urls.py b/apps/authentication/urls/view_urls.py index 2d0749470..9abd61e3b 100644 --- a/apps/authentication/urls/view_urls.py +++ b/apps/authentication/urls/view_urls.py @@ -55,7 +55,6 @@ urlpatterns = [ path('profile/otp/enable/bind/', users_view.UserOtpEnableBindView.as_view(), name='user-otp-enable-bind'), path('profile/otp/disable/', users_view.UserOtpDisableView.as_view(), name='user-otp-disable'), - path('first-login/', users_view.UserFirstLoginView.as_view(), name='user-first-login'), # openid path('cas/', include(('authentication.backends.cas.urls', 'authentication'), namespace='cas')), diff --git a/apps/jumpserver/views/index.py b/apps/jumpserver/views/index.py index 8f974a483..639f6d683 100644 --- a/apps/jumpserver/views/index.py +++ b/apps/jumpserver/views/index.py @@ -1,4 +1,4 @@ -from django.views.generic import TemplateView +from django.views.generic import View from django.shortcuts import redirect from common.permissions import IsValidUser from common.mixins.views import PermissionsMixin @@ -6,8 +6,7 @@ from common.mixins.views import PermissionsMixin __all__ = ['IndexView'] -class IndexView(PermissionsMixin, TemplateView): - template_name = 'index.html' +class IndexView(PermissionsMixin, View): permission_classes = [IsValidUser] def get(self, request, *args, **kwargs): diff --git a/apps/locale/ja/LC_MESSAGES/django.mo b/apps/locale/ja/LC_MESSAGES/django.mo index 663dad9e1..080e2ab5e 100644 --- a/apps/locale/ja/LC_MESSAGES/django.mo +++ b/apps/locale/ja/LC_MESSAGES/django.mo @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:17e378f009274c169039e815158ea9072ee89811bb27a5b17a628f2066fcfb86 +oid sha256:097c6d06ed8dcf2e1807560b6eb52d98cba31f25fe8d67ce4315668c150ca6b8 size 129989 diff --git a/apps/locale/ja/LC_MESSAGES/django.po b/apps/locale/ja/LC_MESSAGES/django.po index cc8a3b317..757d1e463 100644 --- a/apps/locale/ja/LC_MESSAGES/django.po +++ b/apps/locale/ja/LC_MESSAGES/django.po @@ -3188,7 +3188,7 @@ msgid "Can view audit view" msgstr "監査ビューを表示できます" #: rbac/models/menu.py:17 -msgid "Can view workspace view" +msgid "Can view workbench view" msgstr "ワークスペースビューを表示できます" #: rbac/models/menu.py:18 @@ -3271,7 +3271,7 @@ msgid "Console view" msgstr "コンソールビュー" #: rbac/tree.py:27 -msgid "Workspace view" +msgid "Workbench view" msgstr "ワークスペースビュー" #: rbac/tree.py:28 diff --git a/apps/locale/zh/LC_MESSAGES/django.mo b/apps/locale/zh/LC_MESSAGES/django.mo index 944990cc4..88f701b6b 100644 --- a/apps/locale/zh/LC_MESSAGES/django.mo +++ b/apps/locale/zh/LC_MESSAGES/django.mo @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:51c19db490e2e3a7cc3c3fce33b2e4422239d8c64d591208cadaf062c5ccb0c9 +oid sha256:3d6a0d40534209f3ffab0b0ecfab7ec82f137156fc8e7b19ce1711036d14aeca size 107709 diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 68b8a566c..fb29c7d9c 100644 --- a/apps/locale/zh/LC_MESSAGES/django.po +++ b/apps/locale/zh/LC_MESSAGES/django.po @@ -3151,7 +3151,7 @@ msgid "Can view audit view" msgstr "可以显示审计台" #: rbac/models/menu.py:17 -msgid "Can view workspace view" +msgid "Can view workbench view" msgstr "可以显示工作台" #: rbac/models/menu.py:18 @@ -3233,7 +3233,7 @@ msgid "Console view" msgstr "控制台" #: rbac/tree.py:27 -msgid "Workspace view" +msgid "Workbench view" msgstr "工作台" #: rbac/tree.py:28 diff --git a/apps/perms/api/application/user_permission/mixin.py b/apps/perms/api/application/user_permission/mixin.py index b66788c31..6e8f91090 100644 --- a/apps/perms/api/application/user_permission/mixin.py +++ b/apps/perms/api/application/user_permission/mixin.py @@ -22,7 +22,3 @@ class AppRoleUserMixin(_RoleUserMixin): ('get_tree', 'perms.view_myapps'), ('GET', 'perms.view_myapps'), ) - - def dispatch(self, *args, **kwargs): - with tmp_to_root_org(): - return super().dispatch(*args, **kwargs) \ No newline at end of file diff --git a/apps/perms/api/asset/user_permission/mixin.py b/apps/perms/api/asset/user_permission/mixin.py index e06ec9787..c28da6c2d 100644 --- a/apps/perms/api/asset/user_permission/mixin.py +++ b/apps/perms/api/asset/user_permission/mixin.py @@ -36,7 +36,3 @@ class AssetRoleUserMixin(PermBaseMixin, _RoleUserMixin): ('get_tree', 'perms.view_myassets'), ('GET', 'perms.view_myassets'), ) - - def dispatch(self, *args, **kwargs): - with tmp_to_root_org(): - return super().dispatch(*args, **kwargs) diff --git a/apps/perms/utils/asset/user_permission.py b/apps/perms/utils/asset/user_permission.py index 1ea189230..5baa93d01 100644 --- a/apps/perms/utils/asset/user_permission.py +++ b/apps/perms/utils/asset/user_permission.py @@ -202,7 +202,9 @@ class UserGrantedTreeRefreshController: user = self.user with tmp_to_root_org(): - UserAssetGrantedTreeNodeRelation.objects.filter(user=user).exclude(org_id__in=self.org_ids).delete() + UserAssetGrantedTreeNodeRelation.objects.filter(user=user)\ + .exclude(org_id__in=self.org_ids)\ + .delete() if force or self.have_need_refresh_orgs(): with UserGrantedTreeRebuildLock(user_id=user.id): @@ -219,7 +221,9 @@ class UserGrantedTreeRefreshController: utils = UserGrantedTreeBuildUtils(user) utils.rebuild_user_granted_tree() logger.info( - f'Rebuild user tree ok: cost={time.time() - t_start} user={self.user} org={current_org}') + f'Rebuild user tree ok: cost={time.time() - t_start} ' + f'user={self.user} org={current_org}' + ) class UserGrantedUtilsBase: diff --git a/apps/rbac/builtin.py b/apps/rbac/builtin.py index ce735ce8f..4ce706a46 100644 --- a/apps/rbac/builtin.py +++ b/apps/rbac/builtin.py @@ -5,7 +5,7 @@ from .const import Scope, system_exclude_permissions, org_exclude_permissions # Todo: 获取应该区分 系统用户,和组织用户的权限 # 工作台也区分组织后再考虑 user_perms = ( - ('rbac', 'menupermission', 'view', 'workspace'), + ('rbac', 'menupermission', 'view', 'workbench'), ('rbac', 'menupermission', 'view', 'webterminal'), ('rbac', 'menupermission', 'view', 'filemanager'), ('perms', 'permedasset', 'view,connect', 'myassets'), @@ -17,6 +17,7 @@ user_perms = ( ('ops', 'commandexecution', 'add', 'commandexecution'), ('authentication', 'connectiontoken', 'add', 'connectiontoken'), ('tickets', 'ticket', 'view', 'ticket'), + ('orgs', 'organization', 'view', 'rootorg'), ) auditor_perms = user_perms + ( diff --git a/apps/rbac/migrations/0001_initial.py b/apps/rbac/migrations/0001_initial.py index 5687bf574..d3f94f6f2 100644 --- a/apps/rbac/migrations/0001_initial.py +++ b/apps/rbac/migrations/0001_initial.py @@ -27,7 +27,7 @@ class Migration(migrations.Migration): ], options={ 'verbose_name': 'Menu permission', - 'permissions': [('view_console', 'Can view console view'), ('view_audit', 'Can view audit view'), ('view_workspace', 'Can view workspace view')], + 'permissions': [('view_console', 'Can view console view'), ('view_audit', 'Can view audit view'), ('view_workspace', 'Can view workbench view')], 'default_permissions': [], }, ), diff --git a/apps/rbac/migrations/0005_auto_20220307_1524.py b/apps/rbac/migrations/0005_auto_20220307_1524.py index afc8ea8ba..ba4427709 100644 --- a/apps/rbac/migrations/0005_auto_20220307_1524.py +++ b/apps/rbac/migrations/0005_auto_20220307_1524.py @@ -12,6 +12,6 @@ class Migration(migrations.Migration): operations = [ migrations.AlterModelOptions( name='menupermission', - options={'default_permissions': [], 'permissions': [('view_console', 'Can view console view'), ('view_audit', 'Can view audit view'), ('view_workspace', 'Can view workspace view'), ('view_webterminal', 'Can view web terminal'), ('view_filemanager', 'Can view file manager')], 'verbose_name': 'Menu permission'}, + options={'default_permissions': [], 'permissions': [('view_console', 'Can view console view'), ('view_audit', 'Can view audit view'), ('view_workspace', 'Can view workbench view'), ('view_webterminal', 'Can view web terminal'), ('view_filemanager', 'Can view file manager')], 'verbose_name': 'Menu permission'}, ), ] diff --git a/apps/rbac/migrations/0006_auto_20220310_0616.py b/apps/rbac/migrations/0006_auto_20220310_0616.py index 395b73f03..7e3ba72de 100644 --- a/apps/rbac/migrations/0006_auto_20220310_0616.py +++ b/apps/rbac/migrations/0006_auto_20220310_0616.py @@ -12,6 +12,6 @@ class Migration(migrations.Migration): operations = [ migrations.AlterModelOptions( name='menupermission', - options={'default_permissions': [], 'permissions': [('view_console', 'Can view console view'), ('view_audit', 'Can view audit view'), ('view_workspace', 'Can view workspace view'), ('view_webterminal', 'Can view web terminal'), ('view_filemanager', 'Can view file manager') ], 'verbose_name': 'Menu permission'}, + options={'default_permissions': [], 'permissions': [('view_console', 'Can view console view'), ('view_audit', 'Can view audit view'), ('view_workspace', 'Can view workbench view'), ('view_webterminal', 'Can view web terminal'), ('view_filemanager', 'Can view file manager') ], 'verbose_name': 'Menu permission'}, ), ] diff --git a/apps/rbac/migrations/0008_auto_20220411_1709.py b/apps/rbac/migrations/0008_auto_20220411_1709.py new file mode 100644 index 000000000..319fa5a37 --- /dev/null +++ b/apps/rbac/migrations/0008_auto_20220411_1709.py @@ -0,0 +1,22 @@ +# Generated by Django 3.1.14 on 2022-04-11 09:09 + +from django.db import migrations + + +def migrate_workspace_to_workbench(apps, *args): + model = apps.get_model('auth', 'Permission') + model.objects.filter(codename='view_workspace').delete() + + +class Migration(migrations.Migration): + + dependencies = [ + ('rbac', '0007_auto_20220314_1525'), + ] + + operations = [ + migrations.AlterModelOptions( + name='menupermission', + options={'default_permissions': [], 'permissions': [('view_console', 'Can view console view'), ('view_audit', 'Can view audit view'), ('view_workbench', 'Can view workbench view'), ('view_webterminal', 'Can view web terminal'), ('view_filemanager', 'Can view file manager')], 'verbose_name': 'Menu permission'}, + ), + ] diff --git a/apps/rbac/migrations/0009_auto_20220411_1724.py b/apps/rbac/migrations/0009_auto_20220411_1724.py new file mode 100644 index 000000000..4ffb51068 --- /dev/null +++ b/apps/rbac/migrations/0009_auto_20220411_1724.py @@ -0,0 +1,19 @@ +# Generated by Django 3.1.14 on 2022-04-11 09:24 + +from django.db import migrations + + +def migrate_workspace_to_workbench(apps, *args): + model = apps.get_model('auth', 'Permission') + model.objects.filter(codename='view_workspace').delete() + + +class Migration(migrations.Migration): + + dependencies = [ + ('rbac', '0008_auto_20220411_1709'), + ] + + operations = [ + migrations.RunPython(migrate_workspace_to_workbench) + ] diff --git a/apps/rbac/models/menu.py b/apps/rbac/models/menu.py index 524894664..48538199b 100644 --- a/apps/rbac/models/menu.py +++ b/apps/rbac/models/menu.py @@ -14,7 +14,7 @@ class MenuPermission(models.Model): permissions = [ ('view_console', _('Can view console view')), ('view_audit', _('Can view audit view')), - ('view_workspace', _('Can view workspace view')), + ('view_workbench', _('Can view workbench view')), ('view_webterminal', _('Can view web terminal')), ('view_filemanager', _('Can view file manager')), ] diff --git a/apps/rbac/tree.py b/apps/rbac/tree.py index 5ea43e5ee..dfccafa8f 100644 --- a/apps/rbac/tree.py +++ b/apps/rbac/tree.py @@ -1,7 +1,7 @@ #!/usr/bin/python +import os from collections import defaultdict from typing import Callable -import os from django.utils.translation import gettext_lazy as _, gettext, get_language from django.conf import settings @@ -24,7 +24,7 @@ root_node_data = { # 第二层 view 节点,手动创建的 view_nodes_data = [ {'id': 'view_console', 'name': _('Console view')}, - {'id': 'view_workspace', 'name': _('Workspace view')}, + {'id': 'view_workbench', 'name': _('Workbench view')}, {'id': 'view_audit', 'name': _('Audit view')}, {'id': 'view_setting', 'name': _('System setting')}, {'id': 'view_other', 'name': _('Other')}, @@ -55,8 +55,8 @@ extra_nodes_data = [ {"id": "app_change_plan_node", "name": _("App change auth"), "pId": "accounts"}, {"id": "asset_change_plan_node", "name": _("Asset change auth"), "pId": "accounts"}, {"id": "terminal_node", "name": _("Terminal setting"), "pId": "view_setting"}, - {'id': "my_assets", "name": _("My assets"), "pId": "view_workspace"}, - {'id': "my_apps", "name": _("My apps"), "pId": "view_workspace"}, + {'id': "my_assets", "name": _("My assets"), "pId": "view_workbench"}, + {'id': "my_apps", "name": _("My apps"), "pId": "view_workbench"}, ] # 将 model 放到其它节点下,而不是本来的 app 中 @@ -89,7 +89,7 @@ special_pid_mapper = { 'audits.ftplog': 'terminal', 'perms.view_myassets': 'my_assets', 'perms.view_myapps': 'my_apps', - 'ops.add_commandexecution': 'view_workspace', + 'ops.add_commandexecution': 'view_workbench', 'ops.view_commandexecution': 'audits', "perms.view_mykubernetsapp": "my_apps", "perms.connect_mykubernetsapp": "my_apps", @@ -102,9 +102,9 @@ special_pid_mapper = { "settings.view_setting": "view_setting", "rbac.view_console": "view_console", "rbac.view_audit": "view_audit", - "rbac.view_workspace": "view_workspace", - "rbac.view_webterminal": "view_workspace", - "rbac.view_filemanager": "view_workspace", + "rbac.view_workbench": "view_workbench", + "rbac.view_webterminal": "view_workbench", + "rbac.view_filemanager": "view_workbench", 'tickets.view_ticket': 'tickets' } diff --git a/apps/templates/_base_asset_tree_list.html b/apps/templates/_base_asset_tree_list.html deleted file mode 100644 index a989a4da1..000000000 --- a/apps/templates/_base_asset_tree_list.html +++ /dev/null @@ -1,54 +0,0 @@ -{% extends 'base.html' %} -{% load static %} -{% load i18n %} - -{% block help_message %} -{% endblock %} - -{% block content %} -
-
-
- {% include 'assets/_node_tree.html' %} -
-
-
-
- -
-
-
- {% block table_container %} - - - - {% block table_head %} {% endblock %} - - - - {% block table_body %} {% endblock %} - -
- {% endblock %} -
-
-
-
- -{% endblock %} diff --git a/apps/templates/_base_create_update.html b/apps/templates/_base_create_update.html deleted file mode 100644 index d206d40b2..000000000 --- a/apps/templates/_base_create_update.html +++ /dev/null @@ -1,43 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% load static %} -{% load bootstrap3 %} -{% block custom_head_css_js %} - - {% block custom_head_css_js_create %} {% endblock %} -{% endblock %} - -{% block content %} -
-
-
-
-
-
{{ action }}
- -
-
- {% if form.errors.all %} -
- {{ form.errors.all }} -
- {% endif %} - {% block form %} - {% endblock %} -
-
-
-
-
-{% endblock %} - diff --git a/apps/templates/_base_list.html b/apps/templates/_base_list.html deleted file mode 100644 index 9759081bd..000000000 --- a/apps/templates/_base_list.html +++ /dev/null @@ -1,70 +0,0 @@ -{% extends 'base.html' %} -{% load static %} -{% load i18n %} -{% block content %} -
-
-
-
-
-
- {{ action }} -
- -
-
-
- {% block content_left_head %} {% endblock %} - {% block table_search %} - - {% endblock %} -
- {% block table_container %} - - - - {% block table_head %} {% endblock %} - - - - {% block table_body %} {% endblock %} - -
- {% endblock %} -
-
- {% block content_bottom_left %} {% endblock %} -
- {% block table_pagination %} - {% include '_pagination.html' %} - {% endblock %} -
-
-
-
-
-
-{% endblock %} diff --git a/apps/templates/_nav.html b/apps/templates/_nav.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/templates/_nav_user.html b/apps/templates/_nav_user.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/templates/_pagination.html b/apps/templates/_pagination.html deleted file mode 100644 index cf23b04fa..000000000 --- a/apps/templates/_pagination.html +++ /dev/null @@ -1,66 +0,0 @@ -{% load i18n %} -{% load common_tags %} - {% if is_paginated %} -
-
-{# 显示第 {{ page_obj.start_index }} 至 {{ page_obj.end_index }} 项结果,共 {{ paginator.count }} 项#} -
-
-
-
- -
-
- {% endif %} - diff --git a/apps/templates/delete_confirm.html b/apps/templates/delete_confirm.html deleted file mode 100644 index 94f017ca2..000000000 --- a/apps/templates/delete_confirm.html +++ /dev/null @@ -1,15 +0,0 @@ -{% load i18n %} - - - - - {% trans 'Confirm delete' %} - - -
- {% csrf_token %} -

{% trans 'Are you sure delete' %} {{ object.name }} ?

- -
- - \ No newline at end of file diff --git a/apps/templates/index.html b/apps/templates/index.html deleted file mode 100644 index a216ddac8..000000000 --- a/apps/templates/index.html +++ /dev/null @@ -1,618 +0,0 @@ -{% extends 'base.html' %} -{% load i18n %} -{% load static %} -{% block content %} -
-
-
-
-
- Users -
{% trans 'Total users' %}
-
-
-

- All users -
-
-
-
-
-
- Assets -
{% trans 'Total assets' %}
-
-
-

- All assets -
-
-
- -
-
-
- Online -
{% trans 'Online users' %}
-
-
-

- Online users -
-
-
- -
-
-
- Connected -
{% trans 'Online sessions' %}
- -
-
-

- Online sessions -
-
-
-
-
-
- {% trans 'In the past week, a total of ' %}{% trans ' users have logged in ' %}{% trans ' times asset.' %} -
    -
-
-
-
-
-

- {% trans 'Active user asset ratio' %} -

-

- {% trans 'The following graphs describe the percentage of active users per month and assets per user host per month, respectively.' %} -

-
-
-
-
-
{% trans 'User' %}
-
-
-
-
{% trans 'Asset' %}
-
-
-
- -
-
-
-
-
- -
-
-
-
-
{% trans 'Top 10 assets in a week' %}
- -
-
-

{% trans 'Top 10 assets in a week'%}

- {% trans 'Login frequency and last login record.' %} -
-
-
-
-
-
-
-
-
{% trans 'Last 10 login' %}
-
- 10 Messages -
-
-
-

{% trans 'Login record' %}

- {% trans 'Last 10 login records.' %} -
-
-
-
-
-
-
-
-
- -
-
-
-
{% trans 'Top 10 users in a week' %}
- -
-
-

{% trans 'Top 10 users in a week' %}

- {% trans 'User login frequency and last login record.' %} -
-
-
-
-
-
-
- -{% endblock %} - -{% block custom_foot_js %} - - - -{% endblock %} diff --git a/apps/terminal/api/session.py b/apps/terminal/api/session.py index c78d48383..3193956e5 100644 --- a/apps/terminal/api/session.py +++ b/apps/terminal/api/session.py @@ -42,10 +42,9 @@ class MySessionAPIView(generics.ListAPIView): serializer_class = serializers.SessionSerializer def get_queryset(self): - with tmp_to_root_org(): - user = self.request.user - qs = Session.objects.filter(user_id=user.id) - return qs + user = self.request.user + qs = Session.objects.filter(user_id=user.id) + return qs class SessionViewSet(OrgBulkModelViewSet): diff --git a/apps/tickets/api/relation.py b/apps/tickets/api/relation.py index 2dfa33146..5061e6c00 100644 --- a/apps/tickets/api/relation.py +++ b/apps/tickets/api/relation.py @@ -24,10 +24,11 @@ class TicketSessionApi(views.APIView): def get(self, request, *args, **kwargs): with tmp_to_root_org(): - ticketsession = TicketSession.objects.filter(ticket=self.kwargs['ticket_id']).first() - if not ticketsession: + tid = self.kwargs['ticket_id'] + ticket_session = TicketSession.objects.filter(ticket=tid).first() + if not ticket_session: return Response(status=status.HTTP_404_NOT_FOUND) - session = ticketsession.session + session = ticket_session.session serializer = SessionSerializer(session) return Response(serializer.data) diff --git a/apps/users/templates/users/_base_user_detail.html b/apps/users/templates/users/_base_user_detail.html deleted file mode 100644 index 936037ab8..000000000 --- a/apps/users/templates/users/_base_user_detail.html +++ /dev/null @@ -1,26 +0,0 @@ -{% extends 'base.html' %} -{% load static %} -{% load i18n %} - -{% block content %} -
-
-
-
-
- -
-
- {% block content_table %} - {% endblock %} -
-
-
-
-
-{% endblock %} diff --git a/apps/users/templates/users/_granted_assets.html b/apps/users/templates/users/_granted_assets.html deleted file mode 100644 index 9d5006910..000000000 --- a/apps/users/templates/users/_granted_assets.html +++ /dev/null @@ -1,222 +0,0 @@ -{% load i18n %} -
-
-
-
-
- {% trans 'Loading' %} ... -
-
-
-
-
-
-
-
-
- -
-
-
- - - - - - - - {% if show_actions %} - - {% endif %} - - - - -
{% trans 'Hostname' %}{% trans 'IP' %}{% trans 'System user' %}{% trans 'Action' %}
-
-
- diff --git a/apps/users/templates/users/_select_user_modal.html b/apps/users/templates/users/_select_user_modal.html deleted file mode 100644 index 5395b0a05..000000000 --- a/apps/users/templates/users/_select_user_modal.html +++ /dev/null @@ -1,23 +0,0 @@ -{% extends '_modal.html' %} -{% load i18n %} -{% block modal_class %}modal-lg{% endblock %} -{% block modal_id %}select_user_modal{% endblock %} -{% block modal_title%}{% trans "Please Select User" %}{% endblock %} -{% block modal_body %} - - - - - - - - - - - - -
-
-
{% trans 'Name' %}{% trans 'Username' %}{% trans 'Role' %}{% trans 'User group' %}{% trans 'Asset num' %}{% trans 'Active' %}
-{% endblock %} -{% block modal_confirm_id %}btn_select_user{% endblock %} diff --git a/apps/users/templates/users/_user_detail_nav_header.html b/apps/users/templates/users/_user_detail_nav_header.html deleted file mode 100644 index 28079e149..000000000 --- a/apps/users/templates/users/_user_detail_nav_header.html +++ /dev/null @@ -1,97 +0,0 @@ -{% load static %} -{% load i18n %} - - - -
  • - {% trans 'User detail' %} -
  • -
  • - - {% trans "User permissions" %} - - - - -
  • - - \ No newline at end of file diff --git a/apps/users/templates/users/_user_update_pk_modal.html b/apps/users/templates/users/_user_update_pk_modal.html deleted file mode 100644 index a7ed525c4..000000000 --- a/apps/users/templates/users/_user_update_pk_modal.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends '_modal.html' %} -{% load i18n %} -{% block modal_id %}user_update_pk_modal{% endblock %} -{% block modal_title%}{% trans "Update User SSH Public Key" %}{% endblock %} -{% block modal_body %} - -{% endblock %} -{% block modal_confirm_id %}btn_user_update_pk{% endblock %} diff --git a/apps/users/templates/users/first_login.html b/apps/users/templates/users/first_login.html deleted file mode 100644 index bffa2fc0e..000000000 --- a/apps/users/templates/users/first_login.html +++ /dev/null @@ -1,10 +0,0 @@ -{% extends '_base_only_content.html' %} -{% load static %} -{% load i18n %} -{% load bootstrap3 %} - -{% block title %} {% trans 'First Login' %} {% endblock %} - -{% block content %} - 使用UI重构这个页面 -{% endblock %} diff --git a/apps/users/templates/users/first_login_done.html b/apps/users/templates/users/first_login_done.html deleted file mode 100644 index ae43d032b..000000000 --- a/apps/users/templates/users/first_login_done.html +++ /dev/null @@ -1,54 +0,0 @@ -{% extends 'base.html' %} -{% load static %} -{% load i18n %} -{% load bootstrap3 %} - - -{% block custom_head_css_js %} -{{ wizard.form.media }} - -{% endblock %} -{% block first_login_message %}{% endblock %} - -{% block content %} -
    -
    -
    -
    -
    -
    {% trans 'First Login' %}
    - -
    -
    -
    - {% trans 'Welcome to use jumpserver, visit ' %} - {% trans 'Use guide' %} {% trans ' for more information' %} -
    -
    -
    -
    -
    -
    -{% endblock %} - - -{% block custom_foot_js %} - -{% endblock %} diff --git a/apps/users/templates/users/user_asset_permission.html b/apps/users/templates/users/user_asset_permission.html deleted file mode 100644 index d0975f4b8..000000000 --- a/apps/users/templates/users/user_asset_permission.html +++ /dev/null @@ -1,201 +0,0 @@ -{% extends 'users/_base_user_detail.html' %} -{% load static %} -{% load i18n %} - -{% block custom_head_css_js %} - - -{% endblock %} - - -{% block content_table %} -
    -
    -
    - {{ object.name }} -
    - - - - - - - - - - -
    -
    -
    - - - - - - - - - - - - - - - - -
    {% trans 'Name' %}{% trans 'User' %}{% trans 'User group' %}{% trans 'Asset' %}{% trans 'Node' %}{% trans 'System user' %}{% trans 'Validity' %}{% trans 'Action' %}
    -
    -
    -
    - -{% include '_filter_dropdown.html' %} - -{% endblock %} - -{% block custom_foot_js %} - -{% endblock %} diff --git a/apps/users/templates/users/user_database_app_permission.html b/apps/users/templates/users/user_database_app_permission.html deleted file mode 100644 index 73b3a7972..000000000 --- a/apps/users/templates/users/user_database_app_permission.html +++ /dev/null @@ -1,168 +0,0 @@ -{% extends 'users/_base_user_detail.html' %} -{% load static %} -{% load i18n %} - -{% block custom_head_css_js %} - - -{% endblock %} - -{% block content_table %} -
    -
    -
    - {{ object.name }} -
    - - - - - - - - - - -
    -
    -
    - - - - - - - - - - - - - - - -
    {% trans 'Name' %}{% trans 'User' %}{% trans 'User group' %}{% trans 'DatabaseApp' %}{% trans 'System user' %}{% trans 'Validity' %}{% trans 'Action' %}
    -
    -
    -
    -{% endblock %} - -{% block custom_foot_js %} - -{% endblock %} diff --git a/apps/users/templates/users/user_password_update.html b/apps/users/templates/users/user_password_update.html deleted file mode 100644 index 97bc044d6..000000000 --- a/apps/users/templates/users/user_password_update.html +++ /dev/null @@ -1,134 +0,0 @@ -{% extends 'base.html' %} -{% load static %} -{% load i18n %} -{% load bootstrap3 %} - -{% block custom_head_css_js %} - - - - - - - -{% endblock %} -{% block content %} -
    -
    -
    -
    -
    - -
    -
    -
    -
    - {% csrf_token %} - {% bootstrap_field form.old_password layout="horizontal" %} - {% bootstrap_field form.new_password layout="horizontal" %} - {# 密码popover #} -
    - -
    - {% bootstrap_field form.confirm_password layout="horizontal" %} - -
    -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -{% endblock %} - -{% block custom_foot_js %} - - -{% endblock %} diff --git a/apps/users/utils.py b/apps/users/utils.py index b32b0c0e0..f11d233e4 100644 --- a/apps/users/utils.py +++ b/apps/users/utils.py @@ -46,8 +46,6 @@ def get_user_or_pre_auth_user(request): def redirect_user_first_login_or_index(request, redirect_field_name): - # if request.user.is_first_login: - # return reverse('authentication:user-first-login') url_in_post = request.POST.get(redirect_field_name) if url_in_post: return url_in_post diff --git a/apps/users/views/profile/reset.py b/apps/users/views/profile/reset.py index c3529c73c..cc14f6d53 100644 --- a/apps/users/views/profile/reset.py +++ b/apps/users/views/profile/reset.py @@ -21,7 +21,7 @@ from ... import forms __all__ = [ - 'UserLoginView', 'UserResetPasswordView', 'UserForgotPasswordView', 'UserFirstLoginView', + 'UserLoginView', 'UserResetPasswordView', 'UserForgotPasswordView', ] @@ -130,8 +130,3 @@ class UserResetPasswordView(FormView): 'auto_redirect': True, } return FlashMessageUtil.gen_message_url(message_data) - - -class UserFirstLoginView(PermissionsMixin, TemplateView): - template_name = 'users/first_login.html' - permission_classes = [IsValidUser]