Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Postal Owl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jiří Kalvoda
Postal Owl
Commits
cf5ff28d
Commit
cf5ff28d
authored
8 months ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
When showing student threads, check that the student exists and is enrolled
Closes #113.
parent
18dadb0e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
owl/course.py
+8
-1
8 additions, 1 deletion
owl/course.py
with
8 additions
and
1 deletion
owl/course.py
+
8
−
1
View file @
cf5ff28d
...
...
@@ -223,11 +223,18 @@ def topic_index(sident: str, cident: str, tident: str, student_uid: Optional[int
if
student_uid
is
not
None
:
if
not
g
.
is_grader
:
raise
werkzeug
.
exceptions
.
Forbidden
(
'
Only graders are allowed to do that
'
)
enroll
=
sess
.
scalar
(
select
(
db
.
Enroll
)
.
filter_by
(
uid
=
student_uid
,
cid
=
g
.
course
.
cid
,
is_teacher
=
False
)
.
options
(
joinedload
(
db
.
Enroll
.
user
))
)
if
enroll
is
None
:
raise
werkzeug
.
exceptions
.
NotFound
(
'
No such student of this course
'
)
if
g
.
course
.
anon_grading
and
not
g
.
is_teacher
:
show_for_user
=
f
'
Student
{
student_uid
}
'
filename_base
=
str
(
student_uid
)
else
:
show_for_user
=
sess
.
get
(
db
.
User
,
student_uid
)
.
full_name
()
show_for_user
=
enroll
.
user
.
full_name
()
filename_base
=
show_for_user
else
:
show_for_user
=
None
...
...
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