-
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add model to record privileges from legacy toggles and add form-link-…
…workflow to it
- Loading branch information
Showing
5 changed files
with
117 additions
and
1 deletion.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
corehq/apps/accounting/migrations/0065_toggleprivilegerecord.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,23 @@ | ||
# Generated by Django 3.2.16 on 2023-01-17 04:56 | ||
|
||
import django.contrib.postgres.fields | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('accounting', '0064_add_form_link_workflow_priv'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='TogglePrivilegeRecord', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('privilege_slug', models.CharField(max_length=256, unique=True)), | ||
('toggle_slug', models.CharField(max_length=256, unique=True)), | ||
('enabled_domains', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=256), size=None)), | ||
], | ||
), | ||
] |
34 changes: 34 additions & 0 deletions
34
corehq/apps/accounting/migrations/0066_record_toggle_priv_for_form_link_workflow.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,34 @@ | ||
# Generated by Django 3.2.16 on 2023-01-17 04:57 | ||
|
||
from django.db import migrations | ||
from corehq.privileges import FORM_LINK_WORKFLOW | ||
from corehq.util.django_migrations import skip_on_fresh_install | ||
|
||
|
||
@skip_on_fresh_install | ||
def create_record(apps, schema_editor): | ||
from corehq.apps.accounting.models import TogglePrivilegeRecord | ||
TogglePrivilegeRecord.create_from_toggle( | ||
FORM_LINK_WORKFLOW, | ||
FORM_LINK_WORKFLOW | ||
) | ||
|
||
|
||
@skip_on_fresh_install | ||
def delete_record(apps, schema_editor): | ||
from corehq.apps.accounting.models import TogglePrivilegeRecord | ||
TogglePrivilegeRecord.get_by_privilege_slug( | ||
FORM_LINK_WORKFLOW, | ||
).delete() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('accounting', '0065_toggleprivilegerecord'), | ||
] | ||
|
||
|
||
operations = [ | ||
migrations.RunPython(create_record, delete_record), | ||
] |
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