diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3fce49cff58187fc60d9f3b986bd2c004893d214..241d62f2cf2f02d55c303014fe8de6d609efd1bb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -18,6 +18,7 @@ Fixed ~~~~~ * Show link to imprint in footer +* Fix API for adding OAuth scopes in AppConfigs Removed ~~~~~~~ diff --git a/aleksis/core/apps.py b/aleksis/core/apps.py index d9a3f38fa379ddebb10073f7b5afd53301984da1..c14af908faab80f884372e60c6a7ba3ccb8378d0 100644 --- a/aleksis/core/apps.py +++ b/aleksis/core/apps.py @@ -138,7 +138,8 @@ class CoreConfig(AppConfig): # Save the associated person to pick up defaults user.person.save() - def get_all_scopes(self) -> dict[str, str]: + @classmethod + def get_all_scopes(cls) -> dict[str, str]: scopes = { "read": "Read anything the resource owner can read", "write": "Write anything the resource owner can write", diff --git a/aleksis/core/util/apps.py b/aleksis/core/util/apps.py index 5c31ae54acdb711d42084ac9ee4fd52d0335729a..8157f1dcf2668aac249e107b3e37c1b3676ebeed 100644 --- a/aleksis/core/util/apps.py +++ b/aleksis/core/util/apps.py @@ -217,22 +217,25 @@ class AppConfig(django.apps.AppConfig): """ pass - def get_all_scopes(self) -> dict[str, str]: + @classmethod + def get_all_scopes(cls) -> dict[str, str]: """Return all OAuth scopes and their descriptions for this app.""" return {} + @classmethod def get_available_scopes( - self, + cls, application: Optional["AbstractApplication"] = None, request: Optional[HttpRequest] = None, *args, **kwargs, ) -> list[str]: """Return a list of all OAuth scopes available to the request and application.""" - return list(self.get_all_scopes().keys()) + return list(cls.get_all_scopes().keys()) + @classmethod def get_default_scopes( - self, + cls, application: Optional["AbstractApplication"] = None, request: Optional[HttpRequest] = None, *args,