Browse Source

remove rbac redundant perms

pull/9250/head
feng 2 years ago
parent
commit
7094df3527
  1. 2
      apps/rbac/const.py
  2. 9
      apps/rbac/migrations/0011_remove_redundant_permission.py

2
apps/rbac/const.py

@ -52,6 +52,8 @@ exclude_permissions = (
('assets', 'verifyaccountautomation', '*', '*'),
('assets', 'changesecretrecord', 'add,delete,change', 'changesecretrecord'),
('assets', 'automationexecution', '*', 'automationexecution'),
('assets', 'commandfilter', '*', '*'),
('assets', 'commandfilterrule', '*', '*'),
# TODO 暂时去掉历史账号的权限
('assets', 'account', '*', 'assethistoryaccount'),
('assets', 'account', '*', 'assethistoryaccountsecret'),

9
apps/rbac/migrations/0011_remove_redundant_permission.py

@ -7,12 +7,21 @@ def migrate_remove_redundant_permission(apps, *args):
model = apps.get_model('rbac', 'ContentType')
model.objects.filter(app_label='applications').delete()
model.objects.filter(app_label='ops', model='task').delete()
model.objects.filter(app_label='xpack', model__in=[
'applicationchangeauthplan', 'applicationchangeauthplanexecution',
'applicationchangeauthplantask', 'changeauthplan', 'changeauthplanexecution',
'changeauthplantask', 'gatherusertask', 'gatherusertaskexecution'
]).delete()
model.objects.filter(app_label='assets', model__in=[
'authbook', 'historicalauthbook'
]).delete()
model.objects.filter(app_label='perms', model__in=[
'applicationpermission', 'permedapplication', 'commandfilterrule', 'historicalauthbook'
]).delete()
class Migration(migrations.Migration):
dependencies = [

Loading…
Cancel
Save