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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
ead3d596
Verified
Commit
ead3d596
authored
Nov 5, 2021
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
[OAuth] Remove choices for allowed_scopes
Choices cannot be dynamic
parent
a9764e3c
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!759
Resolve "[OAuth] Allow limiting scopes per application"
Pipeline
#39056
canceled
Nov 5, 2021
Stage: test
Stage: build
Stage: publish
Stage: docker
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/core/models.py
+3
-8
3 additions, 8 deletions
aleksis/core/models.py
with
3 additions
and
8 deletions
aleksis/core/models.py
+
3
−
8
View file @
ead3d596
...
@@ -20,7 +20,7 @@ from django.dispatch import receiver
...
@@ -20,7 +20,7 @@ from django.dispatch import receiver
from
django.forms.widgets
import
Media
from
django.forms.widgets
import
Media
from
django.urls
import
reverse
from
django.urls
import
reverse
from
django.utils
import
timezone
from
django.utils
import
timezone
from
django.utils.functional
import
classproperty
,
lazy
from
django.utils.functional
import
classproperty
from
django.utils.text
import
slugify
from
django.utils.text
import
slugify
from
django.utils.translation
import
gettext_lazy
as
_
from
django.utils.translation
import
gettext_lazy
as
_
...
@@ -1105,11 +1105,6 @@ class TaskUserAssignment(ExtensibleModel):
...
@@ -1105,11 +1105,6 @@ class TaskUserAssignment(ExtensibleModel):
verbose_name_plural
=
_
(
"
Task user assignments
"
)
verbose_name_plural
=
_
(
"
Task user assignments
"
)
def
get_scopes_choices
():
from
.util.auth_helpers
import
AppScopes
return
list
(
AppScopes
().
get_all_scopes
().
items
())
get_scopes_choices_lazy
=
lazy
(
get_scopes_choices
,
list
)
class
OAuthApplication
(
AbstractApplication
):
class
OAuthApplication
(
AbstractApplication
):
"""
Modified OAuth application class that supports Grant Flows configured in preferences.
"""
"""
Modified OAuth application class that supports Grant Flows configured in preferences.
"""
...
@@ -1120,8 +1115,8 @@ class OAuthApplication(AbstractApplication):
...
@@ -1120,8 +1115,8 @@ class OAuthApplication(AbstractApplication):
# Optional list of alloewd scopes
# Optional list of alloewd scopes
allowed_scopes
=
ArrayField
(
allowed_scopes
=
ArrayField
(
models
.
CharField
(
max_length
=
32
,
choices
=
get_scopes_choices_lazy
()
),
models
.
CharField
(
max_length
=
32
),
default
=
list
null
=
True
,
)
)
def
allows_grant_type
(
self
,
*
grant_types
:
set
[
str
])
->
bool
:
def
allows_grant_type
(
self
,
*
grant_types
:
set
[
str
])
->
bool
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment