From 52f28872f8499dd03e4907a2f885c71a23810af5 Mon Sep 17 00:00:00 2001 From: jorgepastorr Date: Mon, 18 Sep 2023 09:09:43 +0200 Subject: [PATCH] add module oauth --- orchestra/admin/menu.py | 1 + orchestra/contrib/accounts/apps.py | 8 ++++++++ orchestra/contrib/orchestration/models.py | 3 ++- .../migrations/0003_auto_20230914_1749.py | 18 ++++++++++++++++++ orchestra/urls.py | 2 ++ 5 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 orchestra/contrib/websites/migrations/0003_auto_20230914_1749.py diff --git a/orchestra/admin/menu.py b/orchestra/admin/menu.py index f849829e..8142a5cb 100644 --- a/orchestra/admin/menu.py +++ b/orchestra/admin/menu.py @@ -97,4 +97,5 @@ class OrchestraMenu(Menu): children=process_registry(administration) ), items.MenuItem("API", api_link(context)), + items.ModelList("oauth2", ["oauth2_provider.*"]), ] diff --git a/orchestra/contrib/accounts/apps.py b/orchestra/contrib/accounts/apps.py index 4501614c..def51f65 100644 --- a/orchestra/contrib/accounts/apps.py +++ b/orchestra/contrib/accounts/apps.py @@ -16,3 +16,11 @@ class AccountConfig(AppConfig): accounts.register(Account, icon='Face-monkey.png') post_migrate.connect(create_initial_superuser, dispatch_uid="orchestra.contrib.accounts.management.createsuperuser") + + # from oauth2_provider.models import Grant, AccessToken, RefreshToken, IDToken, Application + # accounts.register(Grant, dashboard=False) + # accounts.register(AccessToken, parent=Grant, dashboard=False) + # accounts.register(RefreshToken, parent=Grant, dashboard=False) + # accounts.register(IDToken, parent=Grant, dashboard=False) + # accounts.register(Application, parent=Grant, dashboard=False) + diff --git a/orchestra/contrib/orchestration/models.py b/orchestra/contrib/orchestration/models.py index 4f8606d8..461cf908 100644 --- a/orchestra/contrib/orchestration/models.py +++ b/orchestra/contrib/orchestration/models.py @@ -161,7 +161,8 @@ class BackendOperation(models.Model): return ServiceBackend.get_backend(self.backend) -autodiscover_modules('backends') +def ready(self): + autodiscover_modules('backends') class RouteQuerySet(models.QuerySet): diff --git a/orchestra/contrib/websites/migrations/0003_auto_20230914_1749.py b/orchestra/contrib/websites/migrations/0003_auto_20230914_1749.py new file mode 100644 index 00000000..023a83e9 --- /dev/null +++ b/orchestra/contrib/websites/migrations/0003_auto_20230914_1749.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.28 on 2023-09-14 15:49 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('websites', '0002_auto_20230817_1149'), + ] + + operations = [ + migrations.AlterField( + model_name='websitedirective', + name='name', + field=models.CharField(choices=[(None, '-------'), ('HTTPD', [('redirect', 'Redirection'), ('proxy', 'Proxy'), ('error-document', 'ErrorDocumentRoot')]), ('SSL', [('ssl-ca', 'SSL CA'), ('ssl-cert', 'SSL cert'), ('ssl-key', 'SSL key')]), ('ModSecurity', [('sec-rule-remove', 'SecRuleRemoveById'), ('sec-engine', 'SecRuleEngine Off')]), ('SaaS', [('wordpress-saas', 'WordPress SaaS')])], db_index=True, max_length=128, verbose_name='name'), + ), + ] diff --git a/orchestra/urls.py b/orchestra/urls.py index e3f7cefb..2b525466 100644 --- a/orchestra/urls.py +++ b/orchestra/urls.py @@ -22,6 +22,8 @@ urlpatterns = [ url(r'^api-token-auth/', obtain_auth_token, name='api-token-auth'), url(r'^media/(.+)/(.+)/(.+)/(.+)/(.+)$', serve_private_media, name='private-media'), # url(r'search', 'orchestra.views.search', name='search'), + # OAUTH + url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')), ]