Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Resint
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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-App-Resint
Commits
1fd13f93
Verified
Commit
1fd13f93
authored
3 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Add OAuth2 scopes to app config
(cherry picked from commit
1d3401aa
)
parent
f4d9a990
No related branches found
No related tags found
1 merge request
!25
Prepare release 2.0b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/resint/apps.py
+14
-0
14 additions, 0 deletions
aleksis/apps/resint/apps.py
aleksis/apps/resint/models.py
+5
-0
5 additions, 0 deletions
aleksis/apps/resint/models.py
with
19 additions
and
0 deletions
aleksis/apps/resint/apps.py
+
14
−
0
View file @
1fd13f93
from
django.apps
import
apps
from
django.utils.translation
import
gettext
as
_
from
aleksis.core.util.apps
import
AppConfig
...
...
@@ -14,3 +17,14 @@ class ResintConfig(AppConfig):
([
2020
,
2021
],
"
Frank Poetzsch-Heffter
"
,
"
p-h@katharineum.de
"
),
([
2019
],
"
Julian Leucker
"
,
"
leuckeju@katharineum.de
"
),
)
@classmethod
def
get_all_scopes
(
cls
)
->
dict
[
str
,
str
]:
"""
Return all OAuth scopes and their descriptions for this app.
"""
LiveDocument
=
apps
.
get_model
(
"
resint
"
,
"
LiveDocument
"
)
scopes
=
{}
for
live_document
in
LiveDocument
.
objects
.
all
():
scopes
[
live_document
.
scope
]
=
_
(
"
Access PDF file for live document {}
"
).
format
(
live_document
.
name
)
return
scopes
This diff is collapsed.
Click to expand it.
aleksis/apps/resint/models.py
+
5
−
0
View file @
1fd13f93
...
...
@@ -193,6 +193,11 @@ class LiveDocument(ExtensiblePolymorphicModel):
"""
Get the filename without path of the PDF file.
"""
return
f
"
{
self
.
slug
}
.pdf
"
@property
def
scope
(
self
)
->
str
:
"""
Return OAuth2 scope name to access PDF file via API.
"""
return
f
"
live_document_pdf_
{
self
.
slug
}
"
def
save
(
self
,
*
args
,
**
kwargs
):
with
reversion
.
create_revision
():
super
().
save
(
*
args
,
**
kwargs
)
...
...
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