Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Merge requests
!698
Resolve "Allow apps to register OAuth scopes"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Allow apps to register OAuth scopes"
495-allow-apps-to-register-oauth-scopes
into
master
Overview
4
Commits
3
Pipelines
4
Changes
5
Merged
Nik | Klampfradler
requested to merge
495-allow-apps-to-register-oauth-scopes
into
master
3 years ago
Overview
4
Commits
3
Pipelines
4
Changes
5
Expand
Closes
#495 (closed)
Edited
3 years ago
by
Jonathan Weth
0
0
Merge request reports
Compare
master
version 2
80e03bc5
3 years ago
version 1
8dbd5226
3 years ago
master (base)
and
latest version
latest version
1b6e4b34
3 commits,
3 years ago
version 2
80e03bc5
2 commits,
3 years ago
version 1
8dbd5226
2 commits,
3 years ago
5 files
+
103
−
8
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
aleksis/core/util/apps.py
+
28
−
1
Options
from
importlib
import
metadata
from
typing
import
Any
,
Optional
,
Sequence
from
typing
import
TYPE_CHECKING
,
Any
,
Optional
,
Sequence
import
django.apps
from
django.contrib.auth.signals
import
user_logged_in
,
user_logged_out
@@ -12,6 +12,9 @@ from spdx_license_list import LICENSES
from
.core_helpers
import
copyright_years
if
TYPE_CHECKING
:
from
oauth2_provider.models
import
AbstractApplication
class
AppConfig
(
django
.
apps
.
AppConfig
):
"""
An extended version of DJango
'
s AppConfig container.
"""
@@ -214,6 +217,30 @@ class AppConfig(django.apps.AppConfig):
"""
pass
def
get_all_scopes
(
self
)
->
dict
[
str
,
str
]:
"""
Return all OAuth scopes and their descriptions for this app.
"""
return
{}
def
get_available_scopes
(
self
,
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
())
def
get_default_scopes
(
self
,
application
:
Optional
[
"
AbstractApplication
"
]
=
None
,
request
:
Optional
[
HttpRequest
]
=
None
,
*
args
,
**
kwargs
,
)
->
list
[
str
]:
"""
Return a list of all OAuth scopes to always include for this request and application.
"""
return
[]
def
_maintain_default_data
(
self
):
from
django.contrib.auth.models
import
Permission
from
django.contrib.contenttypes.models
import
ContentType
Loading