From cd58350b4bfb9a2876d50d64a2990e6e3887bff4 Mon Sep 17 00:00:00 2001
From: Jonathan Weth <git@jonathanweth.de>
Date: Tue, 19 Apr 2022 19:19:20 +0200
Subject: [PATCH] Set max length for allowed_scopes to 255

---
 CHANGELOG.rst                                 |  1 +
 ...040_oauth_allowed_scopes_max_length_255.py | 20 +++++++++++++++++++
 aleksis/core/models.py                        |  2 +-
 3 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 aleksis/core/migrations/0040_oauth_allowed_scopes_max_length_255.py

diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index c2a9e2cfa..31a79e412 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -26,6 +26,7 @@ Fixed
 * Due to a merge error, the once removed account menu in the sidenav appeared again.
 * Scheduled notifications were shown on dashboard before time.
 * Remove broken notifications menu item in favor of item next to account menu.
+* Some views working with OAuth2 scopes didn't work.
 
 Changed
 ~~~~~~~
diff --git a/aleksis/core/migrations/0040_oauth_allowed_scopes_max_length_255.py b/aleksis/core/migrations/0040_oauth_allowed_scopes_max_length_255.py
new file mode 100644
index 000000000..c978c3afc
--- /dev/null
+++ b/aleksis/core/migrations/0040_oauth_allowed_scopes_max_length_255.py
@@ -0,0 +1,20 @@
+# Generated by Django 3.2.13 on 2022-04-19 16:50
+
+import django.contrib.postgres.fields
+from django.db import migrations, models
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('core', '0039_personal_ical_url'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='oauthapplication',
+            name='allowed_scopes',
+            field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=255), blank=True, null=True, size=None, verbose_name='Allowed scopes that clients can request'),
+        ),
+    ]
diff --git a/aleksis/core/models.py b/aleksis/core/models.py
index 963c60c99..462c3a2f8 100644
--- a/aleksis/core/models.py
+++ b/aleksis/core/models.py
@@ -1310,7 +1310,7 @@ class OAuthApplication(AbstractApplication):
 
     # Optional list of alloewd scopes
     allowed_scopes = ArrayField(
-        models.CharField(max_length=32),
+        models.CharField(max_length=255),
         verbose_name=_("Allowed scopes that clients can request"),
         null=True,
         blank=True,
-- 
GitLab