Skip to content

Commit

Permalink
Added BULK_DATA_CLEANING privilege
Browse files Browse the repository at this point in the history
  • Loading branch information
orangejenny committed Mar 3, 2025
1 parent 666d514 commit 94e9d74
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions corehq/apps/accounting/bootstrap/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,5 @@
privileges.GEOCODER,
privileges.DEFAULT_EXPORT_SETTINGS,
privileges.RELEASE_MANAGEMENT,
privileges.BULK_DATA_CLEANING,
]
46 changes: 46 additions & 0 deletions corehq/apps/accounting/migrations/0099_data_cleaning_priv.py
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,
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ def ensure_roles(self, roles, dry_run=False):
Role(slug=privileges.APP_DEPENDENCIES,
name='App Dependencies',
description='Set Android app dependencies that must be installed before using a CommCare app'),
Role(slug=privileges.BULK_DATA_CLEANING, name='Bulk Data Cleaning', description=''),
]

BOOTSTRAP_PLANS = [
Expand Down
3 changes: 3 additions & 0 deletions corehq/privileges.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

BULK_CASE_MANAGEMENT = 'bulk_case_management'
BULK_USER_MANAGEMENT = 'bulk_user_management'
BULK_DATA_CLEANING = 'bulk_data_cleaning'

DEIDENTIFIED_DATA = 'deidentified_data'

Expand Down Expand Up @@ -187,6 +188,7 @@
CASE_DEDUPE,
CUSTOM_DOMAIN_ALERTS,
APP_DEPENDENCIES,
BULK_DATA_CLEANING,
]

# These are special privileges related to their own rates in a SoftwarePlanVersion
Expand Down Expand Up @@ -218,6 +220,7 @@ def get_name_from_privilege(cls, privilege):
CUSTOM_SMS_GATEWAY: _("Custom Android Gateway"),
BULK_CASE_MANAGEMENT: _("Bulk Case Management"),
BULK_USER_MANAGEMENT: _("Bulk User Management"),
BULK_DATA_CLEANING: _("Bulk Data Cleaning"),
ALLOW_EXCESS_USERS: _("Add Mobile Workers Above Limit"),
DEIDENTIFIED_DATA: _("De-Identified Data"),
HIPAA_COMPLIANCE_ASSURANCE: _("HIPAA Compliance Assurance"),
Expand Down
1 change: 1 addition & 0 deletions migrations.lock
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ accounting
0096_formsubmittingmobileworkerhistory_and_featuretype_choice
0097_add_form_submitting_mobile_worker_feature
0098_app_dependencies_priv
0099_data_cleaning_priv
admin
0001_initial
0002_logentry_remove_auto_add
Expand Down

0 comments on commit 94e9d74

Please sign in to comment.