-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate JT project.organization to direct org field
Add migration logic along with general utility for recomputation of parents caching Add JT.organization field in UI Adjust organization counts to directly count JTs
- Loading branch information
1 parent
41b0367
commit 4dc7502
Showing
23 changed files
with
348 additions
and
208 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
52 changes: 52 additions & 0 deletions
52
awx/main/migrations/0082_v360_job_template_organization_field.py
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,52 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.20 on 2019-07-10 20:26 | ||
from __future__ import unicode_literals | ||
|
||
import awx.main.fields | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
from awx.main.migrations._rbac import rebuild_role_parentage, migrate_jt_organization | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('main', '0081_v360_notify_on_start'), | ||
] | ||
|
||
operations = [ | ||
# backwards parents and ancestors caching | ||
migrations.RunPython(migrations.RunPython.noop, rebuild_role_parentage), | ||
# add new organization field for JT | ||
migrations.AddField( | ||
model_name='job', | ||
name='organization', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='jobs', to='main.Organization'), | ||
), | ||
migrations.AddField( | ||
model_name='jobtemplate', | ||
name='organization', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='jobtemplates', to='main.Organization'), | ||
), | ||
# Modifications to JT role parentage | ||
migrations.AlterField( | ||
model_name='jobtemplate', | ||
name='admin_role', | ||
field=awx.main.fields.ImplicitRoleField(editable=False, null='True', on_delete=django.db.models.deletion.CASCADE, parent_role=['organization.job_template_admin_role'], related_name='+', to='main.Role'), | ||
), | ||
migrations.AlterField( | ||
model_name='jobtemplate', | ||
name='execute_role', | ||
field=awx.main.fields.ImplicitRoleField(editable=False, null='True', on_delete=django.db.models.deletion.CASCADE, parent_role=['admin_role', 'organization.execute_role'], related_name='+', to='main.Role'), | ||
), | ||
migrations.AlterField( | ||
model_name='jobtemplate', | ||
name='read_role', | ||
field=awx.main.fields.ImplicitRoleField(editable=False, null='True', on_delete=django.db.models.deletion.CASCADE, parent_role=['organization.auditor_role', 'execute_role', 'admin_role'], related_name='+', to='main.Role'), | ||
), | ||
migrations.RunPython(migrate_jt_organization, migrations.RunPython.noop), | ||
# Re-compute the role parents and ancestors caching | ||
# this may be a no-op because field post_save hooks from migrate_jt_organization | ||
migrations.RunPython(rebuild_role_parentage, migrations.RunPython.noop), | ||
] |
Oops, something went wrong.