Skip to content

Convert StagingApplication to a proxy model #2339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 4.2.19 on 2025-04-18 21:19
from __future__ import annotations

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
('oauth2_provider', '0012_add_token_checksum'),
('api', '0021_stagingapplication_allowed_origins_and_more'),
]

operations = [
migrations.DeleteModel(
name='StagingApplication',
),
migrations.CreateModel(
name='StagingApplication',
fields=[],
options={
'proxy': True,
'indexes': [],
'constraints': [],
},
bases=('oauth2_provider.application',),
),
]
10 changes: 4 additions & 6 deletions dandiapi/api/models/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
from fnmatch import fnmatch

from django.core.exceptions import ValidationError
from django.db import models
from oauth2_provider.models import AbstractApplication
from oauth2_provider.models import Application


class StagingApplication(AbstractApplication):
class StagingApplication(Application):
"""
Custom OAuth Toolkit `Application` model to allow wildcards to be used in redirect URIs.

This is ONLY used in staging; the standard `oauth2_provider.models.Application` is used
in production and local development.
"""

# The default value of `skip_authorization` in `AbstractApplication` is `False`; we
# override that default here for staging.
skip_authorization = models.BooleanField(default=True)
class Meta:
proxy = True

def clean(self):
"""
Expand Down