diff --git a/aleksis/core/util/auth_helpers.py b/aleksis/core/util/auth_helpers.py index 4f6e403cb678ff4a39f0199b0670ff6b3d8cdb45..5febb5a3a79427fffd4d93b0cd0c385602418651 100644 --- a/aleksis/core/util/auth_helpers.py +++ b/aleksis/core/util/auth_helpers.py @@ -106,6 +106,9 @@ class AppScopes(BaseScopes): scopes = [] for app in AppConfig.__subclasses__(): scopes += app.get_available_scopes() + # Filter by allowed scopes of requesting application + if application and application.allowed_scopes: + scopes = list(filter(lambda scope: scope in application.alloewd_scopes, scopes)) return scopes def get_default_scopes( @@ -118,4 +121,7 @@ class AppScopes(BaseScopes): scopes = [] for app in AppConfig.__subclasses__(): scopes += app.get_default_scopes() + # Filter by allowed scopes of requesting application + if application and application.allowed_scopes: + scopes = list(filter(lambda scope: scope in application.alloewd_scopes, scopes)) return scopes