-
-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
666d514
commit 94e9d74
Showing
5 changed files
with
52 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
46 changes: 46 additions & 0 deletions
46
corehq/apps/accounting/migrations/0099_data_cleaning_priv.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,46 @@ | ||
from django.core.management import call_command | ||
from django.db import migrations | ||
|
||
from corehq.privileges import BULK_DATA_CLEANING | ||
from corehq.util.django_migrations import skip_on_fresh_install | ||
|
||
|
||
|
||
@skip_on_fresh_install | ||
def _add_data_cleaning_to_enterprise(apps, schema_editor): | ||
call_command('cchq_prbac_bootstrap') | ||
call_command( | ||
'cchq_prbac_grandfather_privs', | ||
BULK_DATA_CLEANING, | ||
skip_edition='Paused,Community,Standard,Pro,Advanced', | ||
noinput=True, | ||
) | ||
|
||
|
||
def _reverse(apps, schema_editor): | ||
call_command( | ||
'cchq_prbac_revoke_privs', | ||
BULK_DATA_CLEANING, | ||
skip_edition='Paused,Community,Standard,Pro,Advanced', | ||
delete_privs=False, | ||
check_privs_exist=True, | ||
noinput=True, | ||
) | ||
|
||
from corehq.apps.hqadmin.management.commands.cchq_prbac_bootstrap import Command | ||
Command.OLD_PRIVILEGES.append(BULK_DATA_CLEANING) | ||
call_command('cchq_prbac_bootstrap') | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('accounting', '0098_app_dependencies_priv'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
_add_data_cleaning_to_enterprise, | ||
reverse_code=_reverse, | ||
), | ||
] |
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