diff --git a/apps/ops/templates/sudo/list.html b/apps/ops/templates/sudo/list.html index 141fd8710..6c747fa51 100644 --- a/apps/ops/templates/sudo/list.html +++ b/apps/ops/templates/sudo/list.html @@ -3,19 +3,20 @@ {% block table_search %} {% endblock %} {% block table_container %} -
{% trans "Create user" %}
-
{% trans "Import user" %}
+
{% trans "Create sudo" %}
+{#
{% trans "Import user" %}
#} + + @@ -35,8 +36,8 @@ -{% include "users/_user_bulk_update_modal.html" %} -{% include "users/_user_import_modal.html" %} +{#{% include "users/_user_bulk_update_modal.html" %}#} +{#{% include "users/_user_import_modal.html" %}#} {% endblock %} {% block content_bottom_left %}{% endblock %} {% block custom_foot_js %} @@ -47,21 +48,10 @@ $(document).ready(function(){ ele: $('#sudo_list_table'), columnDefs: [ {targets: 1, createdCell: function (td, cellData, rowData) { - var detail_btn = '' + cellData + ''; + var detail_btn = '' + cellData + ''; $(td).html(detail_btn.replace('99991937', rowData.id)); }}, - {targets: 4, createdCell: function (td, cellData) { - var innerHtml = cellData.length > 20 ? cellData.substring(0, 20) + '...': cellData; - $(td).html('' + innerHtml + ''); - }}, - {targets: 5, createdCell: function (td, cellData) { - if (!cellData) { - $(td).html('') - } else { - $(td).html('') - } - }}, - {targets: 6, createdCell: function (td, cellData, rowData) { + {targets: 5, createdCell: function (td, cellData, rowData) { var update_btn = '{% trans "Update" %}'.replace('99991937', cellData); var del_btn = '{% trans "Delete" %}'.replace('99991937', cellData); if (rowData.id === 1 || rowData.username == "admin") { @@ -70,9 +60,9 @@ $(document).ready(function(){ $(td).html(update_btn + del_btn) } }}], - ajax_url: '{% url "api-users:user-list" %}', - columns: [{data: "id"}, {data: "username" }, {data: "name" }, {data: "get_role_display" }, - {data: "groups_display" }, {data: "is_valid" }, {data: "id" }], + ajax_url: '{% url "api-ops:sudo-list" %}', + columns: [{data: "id"}, {data: "name" }, {data: "privilege_items" }, {data: "extra_lines" }, + {data: "created_time" }, {data: "id" }], op_html: $('#actions').html() }; var table = jumpserver.initDataTable(options); diff --git a/apps/ops/urls/api_urls.py b/apps/ops/urls/api_urls.py index dd621ecb6..81a550f66 100644 --- a/apps/ops/urls/api_urls.py +++ b/apps/ops/urls/api_urls.py @@ -7,13 +7,13 @@ from ops import api as v1_api __all__ = ["urlpatterns"] api_router = DefaultRouter() -api_router.register(r'host_alia', v1_api.HostAliaViewSet) -api_router.register(r'user_alia', v1_api.UserAliaViewSet) -api_router.register(r'cmd_alia', v1_api.CmdAliaViewSet) -api_router.register(r'runas_alia', v1_api.RunasAliaViewSet) -api_router.register(r'extra_conf', v1_api.ExtraconfViewSet) -api_router.register(r'privilege', v1_api.PrivilegeViewSet) -api_router.register(r'sudo', v1_api.SudoViewSet) -api_router.register(r'cron', v1_api.CronTableViewSet) +api_router.register(r'v1/host_alia', v1_api.HostAliaViewSet) +api_router.register(r'v1/user_alia', v1_api.UserAliaViewSet) +api_router.register(r'v1/cmd_alia', v1_api.CmdAliaViewSet) +api_router.register(r'v1/runas_alia', v1_api.RunasAliaViewSet) +api_router.register(r'v1/extra_conf', v1_api.ExtraconfViewSet) +api_router.register(r'v1/privilege', v1_api.PrivilegeViewSet) +api_router.register(r'v1/sudo', v1_api.SudoViewSet) +api_router.register(r'v1/cron', v1_api.CronTableViewSet) urlpatterns = api_router.urls \ No newline at end of file diff --git a/apps/ops/urls/view_urls.py b/apps/ops/urls/view_urls.py index cc544db17..d43f1a95c 100644 --- a/apps/ops/urls/view_urls.py +++ b/apps/ops/urls/view_urls.py @@ -11,12 +11,12 @@ urlpatterns = [ # Resource Sudo url url(r'^sudo/list$', page_view.SudoListView.as_view(), name='page-sudo-list'), url(r'^sudo/create$', page_view.SudoCreateView.as_view(), name='page-sudo-create'), - url(r'^sudo/detail$', page_view.SudoDetailView.as_view(), name='page-sudo-detail'), - url(r'^sudo/update$', page_view.SudoUpdateView.as_view(), name='page-sudo-update'), + url(r'^sudo/(?P[0-9]+)/detail$', page_view.SudoDetailView.as_view(), name='page-sudo-detail'), + url(r'^sudo/(?P[0-9]+)/update$', page_view.SudoUpdateView.as_view(), name='page-sudo-update'), # Resource Cron url url(r'^cron/list$', page_view.CronListView.as_view(), name='page-cron-list'), url(r'^cron/create$', page_view.CronCreateView.as_view(), name='page-cron-create'), - url(r'^cron/detail$', page_view.CronDetailView.as_view(), name='page-cron-detail'), - url(r'^cron/update$', page_view.CronUpdateView.as_view(), name='page-cron-update'), + url(r'^cron/(?P[0-9]+)/detail$', page_view.CronDetailView.as_view(), name='page-cron-detail'), + url(r'^cron/(?P[0-9]+)/update$', page_view.CronUpdateView.as_view(), name='page-cron-update'), ] \ No newline at end of file
-{#
#}
{% trans 'Name' %} {% trans 'Privileges' %} {% trans 'Extra Lines' %} {% trans 'Created' %}{% trans 'Action' %}