Skip to content

Commit

Permalink
Merge pull request #1726 from Bidaya0/fix/upgrade_data_to_1.14.0
Browse files Browse the repository at this point in the history
fix:data update
  • Loading branch information
Bidaya0 authored Aug 14, 2023
2 parents ccbb333 + bca9a2c commit 65557f1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dongtai_common/migrations/0002_auto_20230726_1433.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def add_preset_admin_role(apps, schema_editor):
"links",
"project",
"projectManage",
"VulnList",
"vulnList",
"scanList",
"scaList",
"agentManage",
Expand Down Expand Up @@ -119,7 +119,7 @@ def add_preset_admin_role(apps, schema_editor):
"links",
"project",
"projectManage",
"VulnList",
"vulnList",
"scanList",
"scaList",
"agentManage",
Expand Down
26 changes: 26 additions & 0 deletions dongtai_common/migrations/0011_auto_20230814_1537.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 3.2.20 on 2023-08-14 15:37

from django.db import migrations


def update_role_permission(apps, schema_editor):
# We can't import the Person model directly as it may be a newer
# version than this migration expects. We use the historical version.
User = apps.get_model("dongtai_common", "User")
for user in User.objects.all():
if user.pk == 1:
user.role_id = 1
user.is_global_permission = True
else:
user.role_id = 2
user.save()


class Migration(migrations.Migration):
dependencies = [
("dongtai_common", "0010_auto_20230809_1838"),
]

operations = [
migrations.RunPython(update_role_permission),
]

0 comments on commit 65557f1

Please sign in to comment.