2022-02-17 12:13:31 +00:00
|
|
|
# coding:utf-8
|
|
|
|
from rest_framework_bulk.routes import BulkRouter
|
|
|
|
from rest_framework_nested import routers
|
|
|
|
|
|
|
|
from .. import api
|
|
|
|
|
|
|
|
app_name = 'rbac'
|
|
|
|
|
|
|
|
router = BulkRouter()
|
|
|
|
router.register(r'roles', api.RoleViewSet, 'role')
|
|
|
|
router.register(r'role-bindings', api.RoleBindingViewSet, 'role-binding')
|
2022-03-07 07:03:57 +00:00
|
|
|
|
|
|
|
router.register(r'system-roles', api.SystemRoleViewSet, 'system-role')
|
2022-02-17 12:13:31 +00:00
|
|
|
router.register(r'system-role-bindings', api.SystemRoleBindingViewSet, 'system-role-binding')
|
2022-03-07 07:03:57 +00:00
|
|
|
|
|
|
|
router.register(r'org-roles', api.OrgRoleViewSet, 'org-role')
|
2022-02-17 12:13:31 +00:00
|
|
|
router.register(r'org-role-bindings', api.OrgRoleBindingViewSet, 'org-role-binding')
|
2022-03-07 07:03:57 +00:00
|
|
|
|
2022-02-17 12:13:31 +00:00
|
|
|
router.register(r'permissions', api.PermissionViewSet, 'permission')
|
2023-12-05 03:16:34 +00:00
|
|
|
router.register(r'content-types', api.ContentTypeViewSet, 'content-type')
|
2022-02-17 12:13:31 +00:00
|
|
|
|
2022-03-04 09:43:57 +00:00
|
|
|
system_role_router = routers.NestedDefaultRouter(router, r'system-roles', lookup='system_role')
|
|
|
|
system_role_router.register(r'permissions', api.SystemRolePermissionsViewSet, 'system-role-permission')
|
|
|
|
|
|
|
|
org_role_router = routers.NestedDefaultRouter(router, r'org-roles', lookup='org_role')
|
|
|
|
org_role_router.register(r'permissions', api.OrgRolePermissionsViewSet, 'org-role-permission')
|
2022-02-17 12:13:31 +00:00
|
|
|
|
|
|
|
urlpatterns = []
|
|
|
|
|
2022-03-04 09:43:57 +00:00
|
|
|
urlpatterns += router.urls + system_role_router.urls + org_role_router.urls
|