-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): add perm_create_domain / perm_delete_domain
Related: #885
- Loading branch information
1 parent
41c7d90
commit 117c819
Showing
12 changed files
with
209 additions
and
40 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
api/desecapi/migrations/0039_token_perm_create_domain_token_perm_delete_domain.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,36 @@ | ||
# Generated by Django 5.1.2 on 2024-11-01 14:29 | ||
|
||
import django.db.migrations.operations.special | ||
from django.db import migrations, models | ||
|
||
|
||
def forwards_func(apps, schema_editor): | ||
Token = apps.get_model("desecapi", "Token") | ||
db_alias = schema_editor.connection.alias | ||
Token.objects.using(db_alias).filter(domain_policies__isnull=False).update( | ||
perm_create_domain=True, perm_delete_domain=True | ||
) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("desecapi", "0038_user_throttle_daily_rate"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="token", | ||
name="perm_create_domain", | ||
field=models.BooleanField(default=False), | ||
), | ||
migrations.AddField( | ||
model_name="token", | ||
name="perm_delete_domain", | ||
field=models.BooleanField(default=False), | ||
), | ||
migrations.RunPython( | ||
code=forwards_func, | ||
reverse_code=django.db.migrations.operations.special.RunPython.noop, | ||
), | ||
] |
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
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
Oops, something went wrong.