-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #193 from coderbydesign/remove-default-roles
Add data migration to remove default seeded roles
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Generated by Django 2.2.4 on 2020-01-28 20:30 | ||
|
||
from django.db import migrations | ||
|
||
|
||
def remove_unnecessary_platform_default_role(apps, schema_editor): | ||
role_names_to_remove = [ | ||
'Ansible Automation Access', | ||
'Ansible Hub Access', | ||
'Catalog Access', | ||
'Remediations Access', | ||
'Sources Access', | ||
'Subscriptions Access', | ||
] | ||
|
||
Role = apps.get_model('management', 'Role') | ||
Role.objects.filter(system=True, name__in=role_names_to_remove).delete() | ||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('management', '0012_remove_RonR_resources'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(remove_unnecessary_platform_default_role), | ||
] |