mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-10-22 00:09:14 +00:00
feat(perms): 资产授权添加GUI复制粘贴动作
This commit is contained in:
28
apps/perms/migrations/0011_auto_20200721_1739.py
Normal file
28
apps/perms/migrations/0011_auto_20200721_1739.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# Generated by Django 2.2.10 on 2020-07-21 09:39
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
from django.db.models import F
|
||||
from ..models.asset_permission import Action
|
||||
|
||||
|
||||
def migrate_asset_permission(apps, schema_editor):
|
||||
# 已有的资产权限默认拥有剪切板复制粘贴动作
|
||||
AssetPermission = apps.get_model('perms', 'AssetPermission')
|
||||
AssetPermission.objects.all().update(actions=F('actions').bitor(Action.CLIPBOARD_COPY_PASTE))
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('perms', '0010_auto_20191218_1705'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='assetpermission',
|
||||
name='actions',
|
||||
field=models.IntegerField(choices=[(255, 'All'), (1, 'Connect'), (2, 'Upload file'), (4, 'Download file'), (6, 'Upload download'), (8, 'Clipboard copy'), (16, 'Clipboard paste'), (24, 'Clipboard copy paste')], default=255, verbose_name='Actions'),
|
||||
),
|
||||
migrations.RunPython(migrate_asset_permission)
|
||||
]
|
Reference in New Issue
Block a user