# coding:utf-8 from django.urls import path from rest_framework import routers from .. import api app_name = 'perms' router = routers.DefaultRouter() router.register('asset-permissions', api.AssetPermissionViewSet, 'asset-permission') urlpatterns = [ # 查询某个用户授权的资产和资产组 path('user//assets/', api.UserGrantedAssetsApi.as_view(), name='user-assets'), path('user/assets/', api.UserGrantedAssetsApi.as_view(), name='my-assets'), path('user//nodes/', api.UserGrantedNodesApi.as_view(), name='user-nodes'), path('user/nodes/', api.UserGrantedNodesApi.as_view(), name='my-nodes'), path('user/nodes/children/', api.UserGrantedNodeChildrenApi.as_view(), name='my-node-children'), path('user//nodes//assets/', api.UserGrantedNodeAssetsApi.as_view(), name='user-node-assets'), path('user/nodes//assets/', api.UserGrantedNodeAssetsApi.as_view(), name='my-node-assets'), path('user//nodes-assets/', api.UserGrantedNodesWithAssetsApi.as_view(), name='user-nodes-assets'), path('user/nodes-assets/', api.UserGrantedNodesWithAssetsApi.as_view(), name='my-nodes-assets'), path('user//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'), # 查询某个用户组授权的资产和资产组 path('user-group//assets/', api.UserGroupGrantedAssetsApi.as_view(), name='user-group-assets'), path('user-group//nodes/', api.UserGroupGrantedNodesApi.as_view(), name='user-group-nodes'), path('user-group//nodes-assets/', api.UserGroupGrantedNodesWithAssetsApi.as_view(), name='user-group-nodes-assets'), path('user-group//nodes//assets/', api.UserGroupGrantedNodeAssetsApi.as_view(), name='user-group-node-assets'), # 用户和资产授权变更 path('asset-permissions//user/remove/', api.AssetPermissionRemoveUserApi.as_view(), name='asset-permission-remove-user'), path('asset-permissions//user/add/', api.AssetPermissionAddUserApi.as_view(), name='asset-permission-add-user'), path('asset-permissions//asset/remove/', api.AssetPermissionRemoveAssetApi.as_view(), name='asset-permission-remove-asset'), path('asset-permissions//asset/add/', api.AssetPermissionAddAssetApi.as_view(), name='asset-permission-add-asset'), # 验证用户是否有某个资产和系统用户的权限 path('asset-permission/user/validate/', api.ValidateUserAssetPermissionApi.as_view(), name='validate-user-asset-permission'), ] urlpatterns += router.urls