Skip to content

Commit

Permalink
Cleanup guardian in db
Browse files Browse the repository at this point in the history
  • Loading branch information
elias-boulharts committed Sep 6, 2023
1 parent e4d4841 commit 1bed964
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion service_catalog/migrations/0019_auto_20230804_1516.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@


deprecated_permission = ["request_operation_on_instance", "request_support_on_instance", "cancel_request",
"comment_request", "approve_request_approvalstep"]
"comment_request"]
deprecated_permission_model = ["billing_group", "teamrolebinding", "userrolebinding"]


def remove_deprecated_permissions(apps, schema_editor):
Permission = apps.get_model('profiles', 'Permission')
Permission.objects.filter(codename__in=deprecated_permission).delete()
Permission.objects.filter(content_type__model__in=deprecated_permission_model).delete()


class Migration(migrations.Migration):
Expand All @@ -23,6 +25,7 @@ class Migration(migrations.Migration):

operations = [
migrations.RunSQL("DROP TABLE IF EXISTS guardian_userobjectpermission"),
migrations.RunSQL("DROP TABLE IF EXISTS guardian_groupobjectpermission"),
migrations.RunPython(remove_deprecated_permissions),
migrations.AlterModelOptions(
name='instance',
Expand Down

0 comments on commit 1bed964

Please sign in to comment.