-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Workspaces): Always generate an access_token per workspace member…
…ship Also migrate all memberships to create a access_token
- Loading branch information
Showing
3 changed files
with
30 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 4.1.7 on 2023-09-21 14:52 | ||
|
||
from django.db import migrations | ||
|
||
|
||
def generate_tokens(apps, schema_editor): | ||
# Get the model from the versioned app registry | ||
WorkspaceMembership = apps.get_model("workspaces", "WorkspaceMembership") | ||
|
||
# Filter the instances without access_token | ||
memberships_without_token = WorkspaceMembership.objects.filter( | ||
access_token__isnull=True | ||
) | ||
|
||
for membership in memberships_without_token: | ||
membership.generate_access_token() | ||
membership.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("workspaces", "0036_service_account_key_migration"), | ||
] | ||
|
||
operations = [] |
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