2016-09-11 01:50:42 +00:00
|
|
|
# coding:utf-8
|
|
|
|
|
2016-08-09 06:42:21 +00:00
|
|
|
from django.conf.urls import url
|
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-01-09 05:10:28 +00:00
|
|
|
router.register('v1/asset-permissions', api.AssetPermissionViewSet, 'asset-permission')
|
2016-11-09 16:18:57 +00:00
|
|
|
|
2016-11-16 10:12:14 +00:00
|
|
|
urlpatterns = [
|
2017-01-17 09:11:01 +00:00
|
|
|
# 查询某个用户授权的资产和资产组
|
2018-04-11 07:24:12 +00:00
|
|
|
url(r'^v1/user/(?P<pk>[0-9a-zA-Z\-]{36})/assets/$',
|
|
|
|
api.UserGrantedAssetsApi.as_view(), name='user-assets'),
|
|
|
|
url(r'^v1/user/assets/$', api.UserGrantedAssetsApi.as_view(),
|
|
|
|
name='my-assets'),
|
|
|
|
url(r'^v1/user/(?P<pk>[0-9a-zA-Z\-]{36})/nodes/$',
|
|
|
|
api.UserGrantedNodesApi.as_view(), name='user-nodes'),
|
|
|
|
url(r'^v1/user/nodes/$', api.UserGrantedNodesApi.as_view(),
|
|
|
|
name='my-nodes'),
|
|
|
|
url(
|
|
|
|
r'^v1/user/(?P<pk>[0-9a-zA-Z\-]{36})/nodes/(?P<node_id>[0-9a-zA-Z\-]{36})/assets/$',
|
|
|
|
api.UserGrantedNodeAssetsApi.as_view(), name='user-node-assets'),
|
|
|
|
url(r'^v1/user/nodes/(?P<node_id>[0-9a-zA-Z\-]{36})/assets/$',
|
|
|
|
api.UserGrantedNodeAssetsApi.as_view(), name='my-node-assets'),
|
|
|
|
url(r'^v1/user/(?P<pk>[0-9a-zA-Z\-]{36})/nodes-assets/$',
|
|
|
|
api.UserGrantedNodesWithAssetsApi.as_view(), name='user-nodes-assets'),
|
|
|
|
url(r'^v1/user/nodes-assets/$', api.UserGrantedNodesWithAssetsApi.as_view(),
|
|
|
|
name='my-nodes-assets'),
|
2016-11-15 11:33:04 +00:00
|
|
|
|
2017-01-17 09:11:01 +00:00
|
|
|
# 查询某个用户组授权的资产和资产组
|
2018-04-11 07:24:12 +00:00
|
|
|
url(r'^v1/user-group/(?P<pk>[0-9a-zA-Z\-]{36})/assets/$',
|
|
|
|
api.UserGroupGrantedAssetsApi.as_view(), name='user-group-assets'),
|
|
|
|
url(r'^v1/user-group/(?P<pk>[0-9a-zA-Z\-]{36})/nodes/$',
|
|
|
|
api.UserGroupGrantedNodesApi.as_view(), name='user-group-nodes'),
|
|
|
|
url(r'^v1/user-group/(?P<pk>[0-9a-zA-Z\-]{36})/nodes-assets/$',
|
|
|
|
api.UserGroupGrantedNodesWithAssetsApi.as_view(),
|
|
|
|
name='user-group-nodes-assets'),
|
|
|
|
url(
|
|
|
|
r'^v1/user-group/(?P<pk>[0-9a-zA-Z\-]{36})/nodes/(?P<node_id>[0-9a-zA-Z\-]{36})/assets/$',
|
|
|
|
api.UserGroupGrantedNodeAssetsApi.as_view(),
|
|
|
|
name='user-group-node-assets'),
|
|
|
|
|
|
|
|
# 用户和资产授权变更
|
|
|
|
url(r'^v1/asset-permissions/(?P<pk>[0-9a-zA-Z\-]{36})/user/remove/$',
|
|
|
|
api.AssetPermissionRemoveUserApi.as_view(),
|
|
|
|
name='asset-permission-remove-user'),
|
|
|
|
url(r'^v1/asset-permissions/(?P<pk>[0-9a-zA-Z\-]{36})/user/add/$',
|
|
|
|
api.AssetPermissionAddUserApi.as_view(),
|
|
|
|
name='asset-permission-add-user'),
|
|
|
|
url(r'^v1/asset-permissions/(?P<pk>[0-9a-zA-Z\-]{36})/asset/remove/$',
|
|
|
|
api.AssetPermissionRemoveAssetApi.as_view(),
|
|
|
|
name='asset-permission-remove-asset'),
|
|
|
|
url(r'^v1/asset-permissions/(?P<pk>[0-9a-zA-Z\-]{36})/asset/add/$',
|
|
|
|
api.AssetPermissionAddAssetApi.as_view(),
|
|
|
|
name='asset-permission-add-asset'),
|
2017-01-17 09:11:01 +00:00
|
|
|
|
|
|
|
# 验证用户是否有某个资产和系统用户的权限
|
2017-12-19 11:38:09 +00:00
|
|
|
url(r'v1/asset-permission/user/validate/$', api.ValidateUserAssetPermissionView.as_view(), 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
|
|
|
|