perf: 修改 rabc

pull/9649/head
ibuler 2023-02-21 13:40:48 +08:00
parent 0001ffba1b
commit df9e533b3c
3 changed files with 8 additions and 4 deletions

View File

@ -103,7 +103,7 @@ class NodeAddAssetsApi(generics.UpdateAPIView):
instance = None instance = None
permission_classes = (RBACPermission,) permission_classes = (RBACPermission,)
rbac_perms = { rbac_perms = {
'PUT': 'assets.change_assettonode', 'PUT': 'assets.change_assetnodes',
} }
def perform_update(self, serializer): def perform_update(self, serializer):
@ -118,7 +118,7 @@ class NodeRemoveAssetsApi(generics.UpdateAPIView):
instance = None instance = None
permission_classes = (RBACPermission,) permission_classes = (RBACPermission,)
rbac_perms = { rbac_perms = {
'PUT': 'assets.change_assetfromnode', 'PUT': 'assets.change_assetnodes',
} }
def perform_update(self, serializer): def perform_update(self, serializer):
@ -140,7 +140,7 @@ class MoveAssetsToNodeApi(generics.UpdateAPIView):
instance = None instance = None
permission_classes = (RBACPermission,) permission_classes = (RBACPermission,)
rbac_perms = { rbac_perms = {
'PUT': 'assets.change_assettonode', 'PUT': 'assets.change_assetnodes',
} }
def perform_update(self, serializer): def perform_update(self, serializer):

View File

@ -51,6 +51,8 @@ exclude_permissions = (
('assets', 'commandfilterrule', '*', '*'), ('assets', 'commandfilterrule', '*', '*'),
('assets', 'asset', 'add,move', 'assettonode'), ('assets', 'asset', 'add,move', 'assettonode'),
('assets', 'asset', 'remove', 'assetfromnode'), ('assets', 'asset', 'remove', 'assetfromnode'),
('assets', 'asset', 'test', 'account'),
('assets', 'asset', 'push', 'assetaccount'),
('accounts', 'historicalaccount', '*', '*'), ('accounts', 'historicalaccount', '*', '*'),
('accounts', 'accountbaseautomation', '*', '*'), ('accounts', 'accountbaseautomation', '*', '*'),

View File

@ -18,7 +18,8 @@ def migrate_remove_redundant_permission(apps, *args):
model.objects.filter(app_label='assets', model__in=[ model.objects.filter(app_label='assets', model__in=[
'authbook', 'historicalauthbook', 'test_gateway', 'authbook', 'historicalauthbook', 'test_gateway',
'accountbackupplan', 'accountbackupplanexecution', 'gathereduser', 'systemuser' 'accountbackupplan', 'accountbackupplanexecution',
'gathereduser', 'systemuser'
]).delete() ]).delete()
model.objects.filter(app_label='perms', model__in=[ model.objects.filter(app_label='perms', model__in=[
@ -28,6 +29,7 @@ def migrate_remove_redundant_permission(apps, *args):
perm_model = apps.get_model('auth', 'Permission') perm_model = apps.get_model('auth', 'Permission')
perm_model.objects.filter(codename__in=[ perm_model.objects.filter(codename__in=[
'view_permusergroupasset', 'view_permuserasset', 'push_assetsystemuser', 'view_permusergroupasset', 'view_permuserasset', 'push_assetsystemuser',
'add_assettonode', 'move_assettonode', 'remove_assetfromnode',
]).delete() ]).delete()