-
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 #202 from RedHatInsights/master
Promote Changes to QA - 2/11/2020
- Loading branch information
Showing
16 changed files
with
416 additions
and
186 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
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
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
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
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,36 @@ | ||
# Generated by Django 2.2.4 on 2019-11-26 17:03 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def remove_rbac_roles(apps, schema_editor): | ||
# get all permissions/access objects for RBAC | ||
Access = apps.get_model('management', 'Access') | ||
rbac_permissions = Access.objects.filter(permission__contains='rbac:') | ||
|
||
# iterate through all RBAC permissions | ||
for rbac_permission in rbac_permissions: | ||
# get the role for the permission (bubbling up) | ||
role = rbac_permission.role | ||
|
||
# check to see if there are any access objects that are not RBAC | ||
non_rbac_permissions = role.access.exclude(permission__contains='rbac:') | ||
|
||
# if so, just delete the access object we know is RBAC, and leave the role | ||
if non_rbac_permissions: | ||
# this will still delete the resource definitions for the access object | ||
rbac_permission.delete() | ||
else: | ||
# otherwise, we only have RBAC access objects, so delete everything | ||
role.delete() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('management', '0011_group_naming'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(remove_rbac_roles) | ||
] |
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), | ||
] |
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
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
Oops, something went wrong.