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
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
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
Dominic Meiser
website
Commits
6c031182
Unverified
Commit
6c031182
authored
3 years ago
by
Roman Karwacik
Browse files
Options
Downloads
Plain Diff
Merge commit 'refs/merge-requests/43/head' of
https://git.fsmpi.rwth-aachen.de/videoaginfra/website
parents
7cf07700
3e232228
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
l2pauth.py
+6
-25
6 additions, 25 deletions
l2pauth.py
server.py
+0
-12
0 additions, 12 deletions
server.py
template_helper.py
+2
-16
2 additions, 16 deletions
template_helper.py
templates/course.html
+0
-1
0 additions, 1 deletion
templates/course.html
templates/macros.html
+4
-20
4 additions, 20 deletions
templates/macros.html
with
12 additions
and
74 deletions
l2pauth.py
+
6
−
25
View file @
6c031182
...
@@ -2,15 +2,9 @@ import requests
...
@@ -2,15 +2,9 @@ import requests
from
server
import
*
from
server
import
*
L2P_BASE
=
'
https://www3.elearning.rwth-aachen.de/_vti_bin/l2pservices/api.svc/v1/
'
OAUTH_BASE
=
'
https://oauth.campus.rwth-aachen.de/oauth2waitress/oauth2.svc/
'
OAUTH_BASE
=
'
https://oauth.campus.rwth-aachen.de/oauth2waitress/oauth2.svc/
'
MOODLE_BASE
=
'
https://moped.ecampus.rwth-aachen.de/proxy/api/v2/eLearning/Moodle/
'
MOODLE_BASE
=
'
https://moped.ecampus.rwth-aachen.de/proxy/api/v2/eLearning/Moodle/
'
def
l2pget
(
endpoint
,
token
,
**
args
):
args
[
'
accessToken
'
]
=
token
r
=
requests
.
request
(
'
GET
'
,
L2P_BASE
+
endpoint
,
params
=
args
)
return
r
.
json
()
def
moodleget
(
endpoint
,
token
,
**
args
):
def
moodleget
(
endpoint
,
token
,
**
args
):
args
[
'
token
'
]
=
token
args
[
'
token
'
]
=
token
r
=
requests
.
request
(
'
GET
'
,
MOODLE_BASE
+
endpoint
,
params
=
args
)
r
=
requests
.
request
(
'
GET
'
,
MOODLE_BASE
+
endpoint
,
params
=
args
)
...
@@ -23,12 +17,7 @@ def oauthget(endpoint, **args):
...
@@ -23,12 +17,7 @@ def oauthget(endpoint, **args):
@app.route
(
'
/internal/l2pauth
'
)
@app.route
(
'
/internal/l2pauth
'
)
def
start_l2pauth
():
def
start_l2pauth
():
if
'
L2P_APIKEY
'
not
in
config
:
return
"
L2P is no longer available.
"
return
render_template
(
"
500.html
"
),
500
code
=
oauthget
(
'
code
'
,
scope
=
'
l2p2013.rwth
'
)
session
[
'
oauthcode
'
]
=
code
[
'
device_code
'
]
session
[
'
oauthscope
'
]
=
'
l2p
'
return
redirect
(
code
[
'
verification_url
'
]
+
'
?q=verify&d=
'
+
code
[
'
user_code
'
])
@app.route
(
'
/internal/moodleauth
'
)
@app.route
(
'
/internal/moodleauth
'
)
def
start_moodleauth
():
def
start_moodleauth
():
...
@@ -39,6 +28,10 @@ def start_moodleauth():
...
@@ -39,6 +28,10 @@ def start_moodleauth():
session
[
'
oauthscope
'
]
=
'
moodle
'
session
[
'
oauthscope
'
]
=
'
moodle
'
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
():
return
start_moodleauth
()
@app.route
(
'
/internal/rwthauth
'
)
@app.route
(
'
/internal/rwthauth
'
)
def
start_rwthauth
():
def
start_rwthauth
():
if
'
L2P_APIKEY
'
not
in
config
:
if
'
L2P_APIKEY
'
not
in
config
:
...
@@ -48,15 +41,6 @@ def start_rwthauth():
...
@@ -48,15 +41,6 @@ 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
:
...
@@ -67,13 +51,10 @@ def finish_oauth():
...
@@ -67,13 +51,10 @@ 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
'
,
'
l2pandmoodle
'
]:
if
session
[
'
oauthscope
'
]
not
in
[
'
l2p
'
,
'
rwth
'
,
'
moodle
'
,
'
l2pandmoodle
'
]:
return
return
session
[
'
rwthintern
'
]
=
True
session
[
'
rwthintern
'
]
=
True
if
session
[
'
oauthscope
'
]
==
'
l2p
'
or
session
[
'
oauthscope
'
]
==
'
l2pandmoodle
'
:
session
[
'
l2p_courses
'
]
=
[]
for
course
in
l2pget
(
'
viewAllCourseInfo
'
,
token
[
'
access_token
'
])[
'
dataSet
'
]:
session
[
'
l2p_courses
'
].
append
(
course
[
'
uniqueid
'
])
if
session
[
'
oauthscope
'
]
==
'
moodle
'
or
session
[
'
oauthscope
'
]
==
'
l2pandmoodle
'
:
if
session
[
'
oauthscope
'
]
==
'
moodle
'
or
session
[
'
oauthscope
'
]
==
'
l2pandmoodle
'
:
data
=
moodleget
(
'
getmyenrolledcourses
'
,
token
[
'
access_token
'
])
data
=
moodleget
(
'
getmyenrolledcourses
'
,
token
[
'
access_token
'
])
if
data
and
data
.
get
(
'
Data
'
):
if
data
and
data
.
get
(
'
Data
'
):
...
...
This diff is collapsed.
Click to expand it.
server.py
+
0
−
12
View file @
6c031182
...
@@ -345,18 +345,6 @@ def lecture(id, course=None, courseid=None): #pylint: disable=unused-argument,to
...
@@ -345,18 +345,6 @@ 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
'
:
if
'
l2p_courses
'
in
session
:
flash
(
text
+
'
. Du bist kein Teilnehmer des L2P-Kurses!
\
<a target=
"
_blank
"
class=
"
reloadonclose
"
href=
"'
+
url_for
(
'
start_l2pauth
'
)
+
'"
>Kurse aktualisieren</a>.
'
,
category
=
'
player
'
)
else
:
flash
(
text
+
'
. <a target=
"
_blank
"
class=
"
reloadonclose
"
href=
"'
+
url_for
(
'
start_l2pauth
'
)
+
'"
>Hier authorisieren</a>.
'
,
category
=
'
player
'
)
elif
mode
==
'
moodle
'
:
elif
mode
==
'
moodle
'
:
if
'
moodle_courses
'
in
session
:
if
'
moodle_courses
'
in
session
:
flash
(
text
+
'
. Du bist kein Teilnehmer des Moodle-Kurses!
\
flash
(
text
+
'
. Du bist kein Teilnehmer des Moodle-Kurses!
\
...
...
This diff is collapsed.
Click to expand it.
template_helper.py
+
2
−
16
View file @
6c031182
...
@@ -133,7 +133,6 @@ def permdescr(perms): #pylint: disable=too-many-branches,too-many-return-stateme
...
@@ -133,7 +133,6 @@ def permdescr(perms): #pylint: disable=too-many-branches,too-many-return-stateme
perms
=
evalperm
(
perms
)
perms
=
evalperm
(
perms
)
public
=
False
public
=
False
password
=
False
password
=
False
l2p_courses
=
[]
moodle_courses
=
[]
moodle_courses
=
[]
rwth_intern
=
False
rwth_intern
=
False
fsmpi_intern
=
False
fsmpi_intern
=
False
...
@@ -142,8 +141,6 @@ def permdescr(perms): #pylint: disable=too-many-branches,too-many-return-stateme
...
@@ -142,8 +141,6 @@ def permdescr(perms): #pylint: disable=too-many-branches,too-many-return-stateme
public
=
True
public
=
True
elif
perm
[
'
type
'
]
==
'
password
'
:
elif
perm
[
'
type
'
]
==
'
password
'
:
password
=
True
password
=
True
elif
perm
[
'
type
'
]
==
'
l2p
'
:
l2p_courses
.
append
(
perm
[
'
param1
'
])
elif
perm
[
'
type
'
]
==
'
moodle
'
:
elif
perm
[
'
type
'
]
==
'
moodle
'
:
moodle_courses
.
append
(
perm
[
'
param1
'
])
moodle_courses
.
append
(
perm
[
'
param1
'
])
elif
perm
[
'
type
'
]
==
'
rwth
'
:
elif
perm
[
'
type
'
]
==
'
rwth
'
:
...
@@ -158,21 +155,10 @@ def permdescr(perms): #pylint: disable=too-many-branches,too-many-return-stateme
...
@@ -158,21 +155,10 @@ def permdescr(perms): #pylint: disable=too-many-branches,too-many-return-stateme
return
'
rwth
'
,
'
Nur für RWTH-Angehörige verfügbar
'
return
'
rwth
'
,
'
Nur für RWTH-Angehörige verfügbar
'
if
fsmpi_intern
:
if
fsmpi_intern
:
return
'
fsmpi
'
,
'
Nur für Fachschaftler verfügbar
'
return
'
fsmpi
'
,
'
Nur für Fachschaftler verfügbar
'
if
l2p_courses
:
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
'
if
moodle_courses
:
return
'
l2pandmoodle
'
,
'
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
:
else
:
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/course.html
+
0
−
1
View file @
6c031182
...
@@ -126,7 +126,6 @@
...
@@ -126,7 +126,6 @@
<option
selected
value=
"password"
>
Passwort
</option>
<option
selected
value=
"password"
>
Passwort
</option>
<option
value=
"rwth"
>
RWTH intern
</option>
<option
value=
"rwth"
>
RWTH intern
</option>
<option
value=
"fsmpi"
>
FSMPI intern
</option>
<option
value=
"fsmpi"
>
FSMPI intern
</option>
<option
value=
"l2p"
>
L2P Lernraum
</option>
<option
value=
"moodle"
>
Moodle Lernraum
</option>
<option
value=
"moodle"
>
Moodle Lernraum
</option>
<option
value=
"none"
>
Kein Zugriff
</option>
<option
value=
"none"
>
Kein Zugriff
</option>
</select>
</select>
...
...
This diff is collapsed.
Click to expand it.
templates/macros.html
+
4
−
20
View file @
6c031182
...
@@ -195,19 +195,11 @@ $(function() {
...
@@ -195,19 +195,11 @@ $(function() {
<a
target=
"_blank"
href=
"{{ url_for('start_rwthauth') }}"
class=
"btn btn-default reloadonclose"
>
Anmelden
</a>
<a
target=
"_blank"
href=
"{{ url_for('start_rwthauth') }}"
class=
"btn btn-default reloadonclose"
>
Anmelden
</a>
</div>
</div>
{% endif %}
{% endif %}
{% if
'l2p' in permtypes or
'moodle' in permtypes %}
{% if 'moodle' in permtypes %}
<div
class=
"col-sm-4"
>
<div
class=
"col-sm-4"
>
<h4
class=
"text-center"
><span
class=
"glyphicon glyphicon-user"
aria-hidden=
"true"
></span>
L2P/
Moodle
</h4>
<h4
class=
"text-center"
><span
class=
"glyphicon glyphicon-user"
aria-hidden=
"true"
></span>
Moodle
</h4>
<p>
Für Teilnehmer der Veranstaltung verfügbar
</p>
<p>
Für Teilnehmer der Veranstaltung verfügbar
</p>
{% if 'l2p' in permtypes and not 'moodle' in permtypes %}
{% if 'moodle' in permtypes %}
{% if not courses_loaded %}
<a
target=
"_blank"
href=
"{{ url_for('start_l2pauth') }}"
class=
"btn btn-default reloadonclose"
>
Anmelden
</a>
{% else %}
<p
class=
"alert alert-info"
>
Du bist kein Teilnehmer des L2P-Kurses!
</p>
<a
target=
"_blank"
href=
"{{ url_for('start_l2pauth') }}"
class=
"btn btn-default reloadonclose"
>
Kurse aktualisieren
</a>
{% endif %}
{% endif %}
{% if 'moodle' in permtypes and not 'l2p' in permtypes %}
{% if not courses_loaded %}
{% if not courses_loaded %}
<a
target=
"_blank"
href=
"{{ url_for('start_moodleauth') }}"
class=
"btn btn-default reloadonclose"
>
Anmelden
</a>
<a
target=
"_blank"
href=
"{{ url_for('start_moodleauth') }}"
class=
"btn btn-default reloadonclose"
>
Anmelden
</a>
{% else %}
{% else %}
...
@@ -215,18 +207,10 @@ $(function() {
...
@@ -215,18 +207,10 @@ $(function() {
<a
target=
"_blank"
href=
"{{ url_for('start_moodleauth') }}"
class=
"btn btn-default reloadonclose"
>
Kurse aktualisieren
</a>
<a
target=
"_blank"
href=
"{{ url_for('start_moodleauth') }}"
class=
"btn btn-default reloadonclose"
>
Kurse aktualisieren
</a>
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% if 'moodle' in permtypes and 'l2p' in permtypes %}
{% if not courses_loaded %}
<a
target=
"_blank"
href=
"{{ url_for('start_moodlel2pauth') }}"
class=
"btn btn-default reloadonclose"
>
Anmelden
</a>
{% else %}
<p
class=
"alert alert-info"
>
Du bist kein Teilnehmer des L2P oder Moodle-Kurses!
</p>
<a
target=
"_blank"
href=
"{{ url_for('start_moodlel2pauth') }}"
class=
"btn btn-default reloadonclose"
>
Kurse aktualisieren
</a>
{% endif %}
{% endif %}
</div>
</div>
{% endif %}
{% endif %}
</div>
</div>
{% if
'l2p' not in permtypes and
'moodle' not in permtypes and 'rwth' not in permtypes and 'password' not in permtypes %}
{% if 'moodle' not in permtypes and 'rwth' not in permtypes and 'password' not in permtypes %}
<p
class=
"alert alert-info"
style=
"margin-top: 2em;"
>
Nur für Fachschaftler verfügbar.
</p>
<p
class=
"alert alert-info"
style=
"margin-top: 2em;"
>
Nur für Fachschaftler verfügbar.
</p>
{% endif %}
{% endif %}
</div>
</div>
...
...
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