jumpserver/apps/perms/urls/api_urls.py

71 lines
2.9 KiB
Python
Raw Normal View History

2016-09-11 01:50:42 +00:00
# coding:utf-8
2018-07-27 10:56:40 +00:00
from django.urls import path
2016-11-09 16:18:57 +00:00
from rest_framework import routers
2016-11-16 10:12:14 +00:00
from .. import api
2016-09-11 01:50:42 +00:00
app_name = 'perms'
2016-11-09 16:18:57 +00:00
router = routers.DefaultRouter()
2018-07-13 16:47:21 +00:00
router.register('asset-permissions', api.AssetPermissionViewSet, 'asset-permission')
2016-11-09 16:18:57 +00:00
2016-11-16 10:12:14 +00:00
urlpatterns = [
# 查询某个用户授权的资产和资产组
2018-07-27 10:56:40 +00:00
path('user/<uuid:pk>/assets/',
api.UserGrantedAssetsApi.as_view(), name='user-assets'),
path('user/assets/', api.UserGrantedAssetsApi.as_view(),
name='my-assets'),
path('user/<uuid:pk>/nodes/',
api.UserGrantedNodesApi.as_view(), name='user-nodes'),
path('user/nodes/', api.UserGrantedNodesApi.as_view(),
name='my-nodes'),
2018-10-30 04:06:39 +00:00
path('user/nodes/children/', api.UserGrantedNodeChildrenApi.as_view(),
name='my-node-children'),
2018-07-27 10:56:40 +00:00
path('user/<uuid:pk>/nodes/<uuid:node_id>/assets/',
api.UserGrantedNodeAssetsApi.as_view(), name='user-node-assets'),
path('user/nodes/<uuid:node_id>/assets/',
api.UserGrantedNodeAssetsApi.as_view(), name='my-node-assets'),
path('user/<uuid:pk>/nodes-assets/',
api.UserGrantedNodesWithAssetsApi.as_view(), name='user-nodes-assets'),
path('user/nodes-assets/', api.UserGrantedNodesWithAssetsApi.as_view(),
name='my-nodes-assets'),
path('user/<uuid:pk>/nodes-assets/tree/',
api.UserGrantedNodesWithAssetsAsTreeApi.as_view(), name='user-nodes-assets-as-tree'),
path('user/nodes-assets/tree/', api.UserGrantedNodesWithAssetsAsTreeApi.as_view(),
name='my-nodes-assets-as-tree'),
2016-11-15 11:33:04 +00:00
# 查询某个用户组授权的资产和资产组
2018-07-27 10:56:40 +00:00
path('user-group/<uuid:pk>/assets/',
api.UserGroupGrantedAssetsApi.as_view(), name='user-group-assets'),
path('user-group/<uuid:pk>/nodes/',
api.UserGroupGrantedNodesApi.as_view(), name='user-group-nodes'),
path('user-group/<uuid:pk>/nodes-assets/',
api.UserGroupGrantedNodesWithAssetsApi.as_view(),
name='user-group-nodes-assets'),
path('user-group/<uuid:pk>/nodes/<uuid:node_id>/assets/',
api.UserGroupGrantedNodeAssetsApi.as_view(),
name='user-group-node-assets'),
# 用户和资产授权变更
2018-07-27 10:56:40 +00:00
path('asset-permissions/<uuid:pk>/user/remove/',
api.AssetPermissionRemoveUserApi.as_view(),
name='asset-permission-remove-user'),
path('asset-permissions/<uuid:pk>/user/add/',
api.AssetPermissionAddUserApi.as_view(),
name='asset-permission-add-user'),
path('asset-permissions/<uuid:pk>/asset/remove/',
api.AssetPermissionRemoveAssetApi.as_view(),
name='asset-permission-remove-asset'),
path('asset-permissions/<uuid:pk>/asset/add/',
api.AssetPermissionAddAssetApi.as_view(),
name='asset-permission-add-asset'),
# 验证用户是否有某个资产和系统用户的权限
2018-10-30 04:06:39 +00:00
path('asset-permission/user/validate/', api.ValidateUserAssetPermissionApi.as_view(),
2018-07-27 10:56:40 +00:00
name='validate-user-asset-permission'),
2016-10-19 11:30:55 +00:00
]
2016-11-09 16:18:57 +00:00
urlpatterns += router.urls
2016-11-16 10:12:14 +00:00