diff --git a/apps/assets/urls/__init__.py b/apps/assets/urls/__init__.py new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/apps/assets/urls/__init__.py @@ -0,0 +1 @@ + diff --git a/apps/assets/urls/api_urls.py b/apps/assets/urls/api_urls.py new file mode 100644 index 000000000..ca1760404 --- /dev/null +++ b/apps/assets/urls/api_urls.py @@ -0,0 +1,23 @@ +# coding:utf-8 +from django.conf.urls import url +from .. import api +from rest_framework import routers + +app_name = 'assets' + + +router = routers.DefaultRouter() +router.register(r'v1/asset-groups', api.AssetGroupViewSet, 'asset-group') +router.register(r'v1/assets', api.AssetViewSet, 'asset') +router.register(r'v1/idc', api.IDCViewSet, 'idc') +router.register(r'v1/admin-user', api.AdminUserViewSet, 'admin-user') +router.register(r'v1/system-user', api.SystemUserViewSet, 'system-user') + +urlpatterns = [ + url(r'^v1/assets_bulk/$', api.AssetListUpdateApi.as_view(), name='asset-bulk-update'), + # url(r'^v1/idc/(?P[0-9]+)/assets/$', api.IDCAssetsApi.as_view(), name='api-idc-assets'), + url(r'^v1/system-user/auth/', api.SystemUserAuthApi.as_view(), name='system-user-auth'), +] + +urlpatterns += router.urls + diff --git a/apps/assets/urls.py b/apps/assets/urls/views_urls.py similarity index 82% rename from apps/assets/urls.py rename to apps/assets/urls/views_urls.py index 7852bd98b..7b1f4e1bc 100644 --- a/apps/assets/urls.py +++ b/apps/assets/urls/views_urls.py @@ -1,8 +1,6 @@ # coding:utf-8 -from django.conf.urls import url, include -import views -import api -from rest_framework import routers +from django.conf.urls import url +from .. import views app_name = 'assets' @@ -58,17 +56,3 @@ urlpatterns = [ ] -router = routers.DefaultRouter() -router.register(r'v1/asset-groups', api.AssetGroupViewSet, 'asset-group') -router.register(r'v1/assets', api.AssetViewSet, 'asset') -router.register(r'v1/idc', api.IDCViewSet, 'idc') -router.register(r'v1/admin-user', api.AdminUserViewSet, 'admin-user') -router.register(r'v1/system-user', api.SystemUserViewSet, 'system-user') - -urlpatterns += [ - url(r'^v1/assets_bulk/$', api.AssetListUpdateApi.as_view(), name='asset-bulk-update'), - # url(r'^v1/idc/(?P[0-9]+)/assets/$', api.IDCAssetsApi.as_view(), name='api-idc-assets'), - url(r'^v1/system-user/auth/', api.SystemUserAuthApi.as_view(), name='system-user-auth'), -] - -urlpatterns += router.urls diff --git a/apps/audits/urls/__init__.py b/apps/audits/urls/__init__.py new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/apps/audits/urls/__init__.py @@ -0,0 +1 @@ + diff --git a/apps/audits/urls/api_urls.py b/apps/audits/urls/api_urls.py new file mode 100644 index 000000000..2aa429fd0 --- /dev/null +++ b/apps/audits/urls/api_urls.py @@ -0,0 +1,14 @@ +from django.conf.urls import url +from rest_framework import routers + +from .. import api + +app_name = 'audits' + + +router = routers.DefaultRouter() +router.register(r'v1/proxy-log', api.ProxyLogViewSet, 'proxy-log') +router.register(r'v1/command-log', api.CommandLogViewSet, 'command-log') + +urlpatterns = router.urls + diff --git a/apps/audits/urls.py b/apps/audits/urls/views_urls.py similarity index 67% rename from apps/audits/urls.py rename to apps/audits/urls/views_urls.py index 696bd5151..67d5d35c6 100644 --- a/apps/audits/urls.py +++ b/apps/audits/urls/views_urls.py @@ -1,9 +1,5 @@ from django.conf.urls import url - -from rest_framework import routers - -import api -import views +from .. import views app_name = 'audits' @@ -15,8 +11,4 @@ urlpatterns = [ url(r'^login-log$', views.LoginLogListView.as_view(), name='login-log-list'), ] -router = routers.DefaultRouter() -router.register(r'v1/proxy-log', api.ProxyLogViewSet, 'proxy-log') -router.register(r'v1/command-log', api.CommandLogViewSet, 'command-log') -urlpatterns += router.urls diff --git a/apps/jumpserver/urls.py b/apps/jumpserver/urls.py index 8bd94764c..50a4bb77d 100644 --- a/apps/jumpserver/urls.py +++ b/apps/jumpserver/urls.py @@ -22,16 +22,16 @@ from django.views.generic.base import TemplateView urlpatterns = [ url(r'^captcha/', include('captcha.urls')), url(r'^$', TemplateView.as_view(template_name='base.html'), name='index'), - url(r'^users/', include('users.urls', namespace='users')), - url(r'^assets/', include('assets.urls', namespace='assets')), - url(r'^perms/', include('perms.urls', namespace='perms')), - url(r'^audits/', include('audits.urls', namespace='audits')), - url(r'^terminal/', include('terminal.urls', namespace='terminal')), - url(r'^api/users/', include('users.urls', namespace='api-users')), - url(r'^api/assets/', include('assets.urls', namespace='api-assets')), - url(r'^api/perms/', include('perms.urls', namespace='api-perms')), - url(r'^api/audits/', include('audits.urls', namespace='api-audits')), - url(r'^api/terminal/', include('terminal.urls', namespace='api-terminal')), + url(r'^users/', include('users.urls.views_urls', namespace='users')), + url(r'^assets/', include('assets.urls.views_urls', namespace='assets')), + url(r'^perms/', include('perms.urls.views_urls', namespace='perms')), + url(r'^audits/', include('audits.urls.views_urls', namespace='audits')), + url(r'^terminal/', include('terminal.urls.views_urls', namespace='terminal')), + url(r'^api/users/', include('users.urls.api_urls', namespace='api-users')), + url(r'^api/assets/', include('assets.urls.api_urls', namespace='api-assets')), + url(r'^api/perms/', include('perms.urls.api_urls', namespace='api-perms')), + url(r'^api/audits/', include('audits.urls.api_urls', namespace='api-audits')), + url(r'^api/terminal/', include('terminal.urls.api_urls', namespace='api-terminal')), ] diff --git a/apps/ops/urls/__init__.py b/apps/ops/urls/__init__.py new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/apps/ops/urls/__init__.py @@ -0,0 +1 @@ + diff --git a/apps/ops/urls/api_urls.py b/apps/ops/urls/api_urls.py new file mode 100644 index 000000000..d0c6b5204 --- /dev/null +++ b/apps/ops/urls/api_urls.py @@ -0,0 +1,7 @@ +# coding:utf-8 + +from django.conf.urls import url +from rest_framework import routers + + + diff --git a/apps/ops/urls/views_urls.py b/apps/ops/urls/views_urls.py new file mode 100644 index 000000000..a29072e4f --- /dev/null +++ b/apps/ops/urls/views_urls.py @@ -0,0 +1,8 @@ +# coding:utf-8 + +from django.conf.urls import url +from .. import views + +app_name = 'ops' + + diff --git a/apps/perms/urls/__init__.py b/apps/perms/urls/__init__.py new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/apps/perms/urls/__init__.py @@ -0,0 +1 @@ + diff --git a/apps/perms/urls.py b/apps/perms/urls/api_urls.py similarity index 61% rename from apps/perms/urls.py rename to apps/perms/urls/api_urls.py index fc6ef4855..faac46676 100644 --- a/apps/perms/urls.py +++ b/apps/perms/urls/api_urls.py @@ -2,30 +2,14 @@ from django.conf.urls import url from rest_framework import routers -import views -import api +from .. import api app_name = 'perms' -urlpatterns = [ - url(r'^asset-permission$', views.AssetPermissionListView.as_view(), name='asset-permission-list'), - url(r'^asset-permission/create$', views.AssetPermissionCreateView.as_view(), name='asset-permission-create'), - url(r'^asset-permission/(?P[0-9]+)/update$', views.AssetPermissionUpdateView.as_view(), - name='asset-permission-update'), - url(r'^asset-permission/(?P[0-9]+)$', views.AssetPermissionDetailView.as_view(), - name='asset-permission-detail'), - url(r'^asset-permission/(?P[0-9]+)/delete$', views.AssetPermissionDeleteView.as_view(), - name='asset-permission-delete'), - url(r'^asset-permission/(?P[0-9]+)/user$', views.AssetPermissionUserView.as_view(), - name='asset-permission-user-list'), - url(r'^asset-permission/(?P[0-9]+)/asset$', views.AssetPermissionAssetView.as_view(), - name='asset-permission-asset-list'), -] - router = routers.DefaultRouter() router.register('v1/asset-permissions', api.AssetPermissionViewSet, 'asset-permission') -urlpatterns += [ +urlpatterns = [ url(r'^v1/user/my/assets/$', api.MyGrantedAssetsApi.as_view(), name='my-assets'), url(r'^v1/user/my/asset-groups/$', api.MyGrantedAssetsGroupsApi.as_view(), name='my-asset-groups'), url(r'^v1/user/my/asset-group/(?P[0-9]+)/assets/$', api.MyAssetGroupAssetsApi.as_view(), @@ -50,3 +34,4 @@ urlpatterns += [ ] urlpatterns += router.urls + diff --git a/apps/perms/urls/views_urls.py b/apps/perms/urls/views_urls.py new file mode 100644 index 000000000..b73d39fab --- /dev/null +++ b/apps/perms/urls/views_urls.py @@ -0,0 +1,23 @@ +# coding:utf-8 + +from django.conf.urls import url +from .. import views + +app_name = 'perms' + +urlpatterns = [ + url(r'^asset-permission$', views.AssetPermissionListView.as_view(), name='asset-permission-list'), + url(r'^asset-permission/create$', views.AssetPermissionCreateView.as_view(), name='asset-permission-create'), + url(r'^asset-permission/(?P[0-9]+)/update$', views.AssetPermissionUpdateView.as_view(), + name='asset-permission-update'), + url(r'^asset-permission/(?P[0-9]+)$', views.AssetPermissionDetailView.as_view(), + name='asset-permission-detail'), + url(r'^asset-permission/(?P[0-9]+)/delete$', views.AssetPermissionDeleteView.as_view(), + name='asset-permission-delete'), + url(r'^asset-permission/(?P[0-9]+)/user$', views.AssetPermissionUserView.as_view(), + name='asset-permission-user-list'), + url(r'^asset-permission/(?P[0-9]+)/asset$', views.AssetPermissionAssetView.as_view(), + name='asset-permission-asset-list'), +] + + diff --git a/apps/terminal/urls/__init__.py b/apps/terminal/urls/__init__.py new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/apps/terminal/urls/__init__.py @@ -0,0 +1 @@ + diff --git a/apps/terminal/urls/api_urls.py b/apps/terminal/urls/api_urls.py new file mode 100644 index 000000000..316e67e1e --- /dev/null +++ b/apps/terminal/urls/api_urls.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# + +from rest_framework import routers + +from .. import api + +app_name = 'terminal' + +router = routers.DefaultRouter() +router.register(r'v1/terminal/heatbeat', api.TerminalHeatbeatViewSet, 'terminal-heatbeat') +router.register(r'v1/terminal', api.TerminalViewSet, 'terminal') + +urlpatterns = router.urls + diff --git a/apps/terminal/urls/views_urls.py b/apps/terminal/urls/views_urls.py new file mode 100644 index 000000000..ac5f1e827 --- /dev/null +++ b/apps/terminal/urls/views_urls.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# + +from django.conf.urls import url + +from .. import views + +app_name = 'terminal' + +urlpatterns = [ + url(r'^terminal$', views.TerminalListView.as_view(), name='terminal-list'), + url(r'^terminal/(?P\d+)/update$', views.TerminalUpdateView.as_view(), name='terminal-update'), +] diff --git a/apps/users/urls/__init__.py b/apps/users/urls/__init__.py new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/apps/users/urls/__init__.py @@ -0,0 +1 @@ + diff --git a/apps/users/urls/api_urls.py b/apps/users/urls/api_urls.py new file mode 100644 index 000000000..bc6f3fcb0 --- /dev/null +++ b/apps/users/urls/api_urls.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# ~*~ coding: utf-8 ~*~ +# +from __future__ import absolute_import + +from django.conf.urls import url +from rest_framework_bulk.routes import BulkRouter +from .. import api + +app_name = 'users' + +router = BulkRouter() +router.register(r'v1/users', api.UserViewSet, 'user') +router.register(r'v1/user-groups', api.UserGroupViewSet, 'user-group') +# router.register(r'v1/user-groups', api.AssetViewSet, 'api-groups') + + +urlpatterns = [ + # url(r'^v1/users/$', api.UserListUpdateApi.as_view(), name='user-bulk-update-api'), + url(r'^v1/users/token/$', api.UserAuthApi.as_view(), name='user-token'), + url(r'^v1/users/(?P\d+)/reset-password/$', api.UserResetPasswordApi.as_view(), name='user-reset-password'), + url(r'^v1/users/(?P\d+)/reset-pk/$', api.UserResetPKApi.as_view(), name='user-reset-pk'), + url(r'^v1/users/(?P\d+)/update-pk/$', api.UserUpdatePKApi.as_view(), name='user-update-pk'), + # url(r'^v1/user-groups/$', api.GroupListUpdateApi.as_view(), name='user-group-bulk-update-api'), + # url(r'^v1/user-groups/(?P\d+)/$', api.GroupDetailApi.as_view(), name='user-group-detail-api'), + # url(r'^v1/user-groups/(?P\d+)/user/(?P\d+)/$', + # api.DeleteUserFromGroupApi.as_view(), name='delete-user-from-group-api'), + url(r'^v1/users/(?P\d+)/groups/$', + api.UserUpdateGroupApi.as_view(), name='user-update-group'), + url(r'^v1/user-groups/(?P\d+)/users/$', + api.UserGroupUpdateUserApi.as_view(), name='user-group-update-user'), +] + +urlpatterns += router.urls diff --git a/apps/users/urls.py b/apps/users/urls/views_urls.py similarity index 65% rename from apps/users/urls.py rename to apps/users/urls/views_urls.py index 065bf24cb..b5f23c7f2 100644 --- a/apps/users/urls.py +++ b/apps/users/urls/views_urls.py @@ -1,7 +1,7 @@ +from __future__ import absolute_import + from django.conf.urls import url -from rest_framework_bulk.routes import BulkRouter -import views -import api +from .. import views app_name = 'users' @@ -41,28 +41,3 @@ urlpatterns = [ url(r'^user-group/(?P[0-9]+)/assets', views.UserGroupGrantedAssetView.as_view(), name='user-group-granted-asset'), ] - - -router = BulkRouter() -router.register(r'v1/users', api.UserViewSet, 'user') -router.register(r'v1/user-groups', api.UserGroupViewSet, 'user-group') -# router.register(r'v1/user-groups', api.AssetViewSet, 'api-groups') - - -urlpatterns += [ - # url(r'^v1/users/$', api.UserListUpdateApi.as_view(), name='user-bulk-update-api'), - url(r'^v1/users/token/$', api.UserAuthApi.as_view(), name='user-token'), - url(r'^v1/users/(?P\d+)/reset-password/$', api.UserResetPasswordApi.as_view(), name='user-reset-password'), - url(r'^v1/users/(?P\d+)/reset-pk/$', api.UserResetPKApi.as_view(), name='user-reset-pk'), - url(r'^v1/users/(?P\d+)/update-pk/$', api.UserUpdatePKApi.as_view(), name='user-update-pk'), - # url(r'^v1/user-groups/$', api.GroupListUpdateApi.as_view(), name='user-group-bulk-update-api'), - # url(r'^v1/user-groups/(?P\d+)/$', api.GroupDetailApi.as_view(), name='user-group-detail-api'), - # url(r'^v1/user-groups/(?P\d+)/user/(?P\d+)/$', - # api.DeleteUserFromGroupApi.as_view(), name='delete-user-from-group-api'), - url(r'^v1/users/(?P\d+)/groups/$', - api.UserUpdateGroupApi.as_view(), name='user-update-group'), - url(r'^v1/user-groups/(?P\d+)/users/$', - api.UserGroupUpdateUserApi.as_view(), name='user-group-update-user'), -] - -urlpatterns += router.urls