Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Video AG Infrastruktur
website
Commits
af4dec05
Commit
af4dec05
authored
4 years ago
by
Roman Karwacik
Committed by
Andreas Valder
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix for authentification if both moodle and l2p rooms are available
parent
f46c791c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
l2pauth.py
+12
-3
12 additions, 3 deletions
l2pauth.py
server.py
+6
-0
6 additions, 0 deletions
server.py
template_helper.py
+8
-0
8 additions, 0 deletions
template_helper.py
templates/macros.html
+1
-1
1 addition, 1 deletion
templates/macros.html
with
27 additions
and
4 deletions
l2pauth.py
+
12
−
3
View file @
af4dec05
...
@@ -48,6 +48,15 @@ def start_rwthauth():
...
@@ -48,6 +48,15 @@ def start_rwthauth():
session
[
'
oauthscope
'
]
=
'
rwth
'
session
[
'
oauthscope
'
]
=
'
rwth
'
return
redirect
(
code
[
'
verification_url
'
]
+
'
?q=verify&d=
'
+
code
[
'
user_code
'
])
return
redirect
(
code
[
'
verification_url
'
]
+
'
?q=verify&d=
'
+
code
[
'
user_code
'
])
@app.route
(
'
/internal/moodlel2pauth
'
)
def
start_moodlel2pauth
():
if
'
L2P_APIKEY
'
not
in
config
:
return
render_template
(
"
500.html
"
),
500
code
=
oauthget
(
'
code
'
,
scope
=
'
moodle.rwth l2p2013.rwth
'
)
session
[
'
oauthcode
'
]
=
code
[
'
device_code
'
]
session
[
'
oauthscope
'
]
=
'
l2pandmoodle
'
return
redirect
(
code
[
'
verification_url
'
]
+
'
?q=verify&d=
'
+
code
[
'
user_code
'
])
@app.before_request
@app.before_request
def
finish_oauth
():
def
finish_oauth
():
if
'
L2P_APIKEY
'
not
in
config
:
if
'
L2P_APIKEY
'
not
in
config
:
...
@@ -58,14 +67,14 @@ def finish_oauth():
...
@@ -58,14 +67,14 @@ def finish_oauth():
if
token
.
get
(
'
status
'
)
!=
'
ok
'
:
if
token
.
get
(
'
status
'
)
!=
'
ok
'
:
return
return
del
session
[
'
oauthcode
'
]
del
session
[
'
oauthcode
'
]
if
session
[
'
oauthscope
'
]
not
in
[
'
l2p
'
,
'
rwth
'
,
'
moodle
'
]:
if
session
[
'
oauthscope
'
]
not
in
[
'
l2p
'
,
'
rwth
'
,
'
moodle
'
,
'
l2pandmoodle
'
]:
return
return
session
[
'
rwthintern
'
]
=
True
session
[
'
rwthintern
'
]
=
True
if
session
[
'
oauthscope
'
]
==
'
l2p
'
:
if
session
[
'
oauthscope
'
]
==
'
l2p
'
or
session
[
'
oauthscope
'
]
==
'
l2pandmoodle
'
:
session
[
'
l2p_courses
'
]
=
[]
session
[
'
l2p_courses
'
]
=
[]
for
course
in
l2pget
(
'
viewAllCourseInfo
'
,
token
[
'
access_token
'
])[
'
dataSet
'
]:
for
course
in
l2pget
(
'
viewAllCourseInfo
'
,
token
[
'
access_token
'
])[
'
dataSet
'
]:
session
[
'
l2p_courses
'
].
append
(
course
[
'
uniqueid
'
])
session
[
'
l2p_courses
'
].
append
(
course
[
'
uniqueid
'
])
el
if
session
[
'
oauthscope
'
]
==
'
moodle
'
:
if
session
[
'
oauthscope
'
]
==
'
moodle
'
or
session
[
'
oauthscope
'
]
==
'
l2pand
moodle
'
:
data
=
moodleget
(
'
getmyenrolledcourses
'
,
token
[
'
access_token
'
])
data
=
moodleget
(
'
getmyenrolledcourses
'
,
token
[
'
access_token
'
])
if
data
and
data
.
get
(
'
Data
'
):
if
data
and
data
.
get
(
'
Data
'
):
session
[
'
moodle_courses
'
]
=
[]
session
[
'
moodle_courses
'
]
=
[]
...
...
This diff is collapsed.
Click to expand it.
server.py
+
6
−
0
View file @
af4dec05
...
@@ -329,6 +329,12 @@ def lecture(id, course=None, courseid=None): #pylint: disable=unused-argument,to
...
@@ -329,6 +329,12 @@ def lecture(id, course=None, courseid=None): #pylint: disable=unused-argument,to
mode
,
text
=
permdescr
(
perms
)
mode
,
text
=
permdescr
(
perms
)
if
mode
==
'
rwth
'
:
if
mode
==
'
rwth
'
:
flash
(
text
+
'
. <a target=
"
_blank
"
class=
"
reloadonclose
"
href=
"'
+
url_for
(
'
start_rwthauth
'
)
+
'"
>Hier authorisieren</a>.
'
,
category
=
'
player
'
)
flash
(
text
+
'
. <a target=
"
_blank
"
class=
"
reloadonclose
"
href=
"'
+
url_for
(
'
start_rwthauth
'
)
+
'"
>Hier authorisieren</a>.
'
,
category
=
'
player
'
)
elif
mode
==
'
l2pandmoodle
'
:
if
'
l2p_courses
'
in
session
or
'
moodle_courses
'
in
session
:
flash
(
text
+
'
. Du bist kein Teilnehmer des L2P oder Moodle-Kurses!
\
<a target=
"
_blank
"
class=
"
reloadonclose
"
href=
"'
+
url_for
(
'
start_moodlel2pauth
'
)
+
'"
>Kurse aktualisieren</a>.
'
,
category
=
'
player
'
)
else
:
flash
(
text
+
'
. <a target=
"
_blank
"
class=
"
reloadonclose
"
href=
"'
+
url_for
(
'
start_moodlel2pauth
'
)
+
'"
>Hier authorisieren</a>.
'
,
category
=
'
player
'
)
elif
mode
==
'
l2p
'
:
elif
mode
==
'
l2p
'
:
if
'
l2p_courses
'
in
session
:
if
'
l2p_courses
'
in
session
:
flash
(
text
+
'
. Du bist kein Teilnehmer des L2P-Kurses!
\
flash
(
text
+
'
. Du bist kein Teilnehmer des L2P-Kurses!
\
...
...
This diff is collapsed.
Click to expand it.
template_helper.py
+
8
−
0
View file @
af4dec05
...
@@ -141,11 +141,19 @@ def permdescr(perms): #pylint: disable=too-many-branches,too-many-return-stateme
...
@@ -141,11 +141,19 @@ def permdescr(perms): #pylint: disable=too-many-branches,too-many-return-stateme
return
'
fsmpi
'
,
'
Nur für Fachschaftler verfügbar
'
return
'
fsmpi
'
,
'
Nur für Fachschaftler verfügbar
'
if
l2p_courses
:
if
l2p_courses
:
if
password
:
if
password
:
if
moodle_courses
:
return
'
l2pandmoodle
'
,
'
Nur für Teilnehmer der Veranstaltung und Nutzer mit Passwort verfügbar
'
return
'
l2p
'
,
'
Nur für Teilnehmer der Veranstaltung und Nutzer mit Passwort verfügbar
'
return
'
l2p
'
,
'
Nur für Teilnehmer der Veranstaltung und Nutzer mit Passwort verfügbar
'
if
moodle_courses
:
return
'
l2pandmoodle
'
,
'
Nur für Teilnehmer der Veranstaltung verfügbar
'
return
'
l2p
'
,
'
Nur für Teilnehmer der Veranstaltung verfügbar
'
return
'
l2p
'
,
'
Nur für Teilnehmer der Veranstaltung verfügbar
'
if
moodle_courses
:
if
moodle_courses
:
if
password
:
if
password
:
if
l2p_courses
:
return
'
l2pandmoodle
'
,
'
Nur für Teilnehmer der Veranstaltung und Nutzer mit Passwort verfügbar
'
return
'
moodle
'
,
'
Nur für Teilnehmer der Veranstaltung und Nutzer mit Passwort verfügbar
'
return
'
moodle
'
,
'
Nur für Teilnehmer der Veranstaltung und Nutzer mit Passwort verfügbar
'
if
l2p_courses
:
return
'
l2pandmoodle
'
,
'
Nur für Teilnehmer der Veranstaltung verfügbar
'
return
'
moodle
'
,
'
Nur für Teilnehmer der Veranstaltung verfügbar
'
return
'
moodle
'
,
'
Nur für Teilnehmer der Veranstaltung verfügbar
'
if
password
:
if
password
:
return
'
password
'
,
'
Nur für Nutzer mit Passwort verfügbar
'
return
'
password
'
,
'
Nur für Nutzer mit Passwort verfügbar
'
...
...
This diff is collapsed.
Click to expand it.
templates/macros.html
+
1
−
1
View file @
af4dec05
...
@@ -377,7 +377,7 @@ $('#embedcodebtn').popover(
...
@@ -377,7 +377,7 @@ $('#embedcodebtn').popover(
{% if permdescription[0] == 'l2p' %}
{% if permdescription[0] == 'l2p' %}
{% set permlogos = '
<span
class=
"fa"
aria-hidden=
"true"
style=
"width: 12px; height: 14px; background-size: cover; background-image: url(\'/static/l2p-logo.gif\');"
></span>
' %}
{% set permlogos = '
<span
class=
"fa"
aria-hidden=
"true"
style=
"width: 12px; height: 14px; background-size: cover; background-image: url(\'/static/l2p-logo.gif\');"
></span>
' %}
{% endif %}
{% endif %}
{% if permdescription[0] == 'moodle' %}
{% if permdescription[0] == 'moodle'
or permdescription[0] == 'l2pandmoodle'
%}
{% set permlogos = '
<span
class=
"fa"
aria-hidden=
"true"
style=
"width: 20px; height: 14px; background-size: cover; background-image: url(\'/static/moodle.png\');"
></span>
' %}
{% set permlogos = '
<span
class=
"fa"
aria-hidden=
"true"
style=
"width: 20px; height: 14px; background-size: cover; background-image: url(\'/static/moodle.png\');"
></span>
' %}
{% endif %}
{% endif %}
{% if permdescription[0] == 'rwth' %}
{% if permdescription[0] == 'rwth' %}
...
...
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