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()
|
2017-01-17 09:11:01 +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
|
|
|
# 用户可以使用自己的Token或其它认证查看自己授权的资产,资产组等
|
|
|
|
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'),
|
2017-03-31 16:41:16 +00:00
|
|
|
url(r'^v1/user/my/asset-groups-assets/$',
|
|
|
|
api.MyAssetGroupAssetsApi.as_view(),
|
|
|
|
name='my-asset-group-assets'),
|
2017-01-17 09:11:01 +00:00
|
|
|
url(r'^v1/user/my/asset-group/(?P<pk>[0-9]+)/assets/$',
|
2017-03-29 07:26:32 +00:00
|
|
|
api.MyAssetGroupOfAssetsApi.as_view(),
|
|
|
|
name='my-asset-group-of-assets'),
|
2016-11-15 11:33:04 +00:00
|
|
|
|
2017-01-17 09:11:01 +00:00
|
|
|
# 查询某个用户授权的资产和资产组
|
|
|
|
url(r'^v1/user/(?P<pk>[0-9]+)/assets/$',
|
|
|
|
api.UserGrantedAssetsApi.as_view(),
|
|
|
|
name='user-assets'),
|
|
|
|
url(r'^v1/user/(?P<pk>[0-9]+)/asset-groups/$',
|
|
|
|
api.UserGrantedAssetGroupsApi.as_view(),
|
2016-11-16 09:45:46 +00:00
|
|
|
name='user-asset-groups'),
|
2016-11-15 11:33:04 +00:00
|
|
|
|
2017-01-17 09:11:01 +00:00
|
|
|
# 查询某个用户组授权的资产和资产组
|
|
|
|
url(r'^v1/user-group/(?P<pk>[0-9]+)/assets/$',
|
|
|
|
api.UserGroupGrantedAssetsApi.as_view(),
|
|
|
|
name='user-group-assets'),
|
|
|
|
url(r'^v1/user-group/(?P<pk>[0-9]+)/asset-groups/$',
|
|
|
|
api.UserGroupGrantedAssetGroupsApi.as_view(),
|
2016-11-16 09:45:46 +00:00
|
|
|
name='user-group-asset-groups'),
|
2016-11-15 15:09:36 +00:00
|
|
|
|
2017-01-17 09:11:01 +00:00
|
|
|
# 回收用户或用户组授权
|
|
|
|
url(r'^v1/asset-permissions/user/revoke/$',
|
|
|
|
api.RevokeUserAssetPermission.as_view(),
|
2016-11-10 08:59:50 +00:00
|
|
|
name='revoke-user-asset-permission'),
|
2017-01-17 09:11:01 +00:00
|
|
|
url(r'^v1/asset-permissions/user-group/revoke/$',
|
|
|
|
api.RevokeUserGroupAssetPermission.as_view(),
|
2016-11-15 11:33:04 +00:00
|
|
|
name='revoke-user-group-asset-permission'),
|
2017-01-17 09:11:01 +00:00
|
|
|
|
|
|
|
# 验证用户是否有某个资产和系统用户的权限
|
|
|
|
url(r'v1/asset-permission/user/validate/$',
|
|
|
|
api.ValidateUserAssetPermissionView.as_view(),
|
2017-02-06 15:13:27 +00:00
|
|
|
name='validate-user-asset-permission'),
|
|
|
|
|
|
|
|
# 删除asset permission中的某个系统用户
|
|
|
|
url(r'^v1/asset-permissions/(?P<pk>[0-9]+)/system-user/remove/$',
|
|
|
|
api.RemoveSystemUserAssetPermission.as_view(),
|
|
|
|
name='remove-system-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
|
|
|
|