Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Queue
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIP
Labrador
Queue
Merge requests
!385
Resolve "Manager cannot update student/assistant"
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Resolve "Manager cannot update student/assistant"
303-manager-cannot-update-student-assistant
into
development
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
Resolve "Manager cannot update student/assistant"
Cédric Willekens
requested to merge
303-manager-cannot-update-student-assistant
into
development
Sep 8, 2020
Overview
0
Commits
1
Pipelines
0
Changes
1
Make sure to read our
contributing guide
Closes
#303 (closed)
Edited
Sep 9, 2020
by
Cédric Willekens
0
0
Merge request reports
Compare
development
development (base)
and
latest version
latest version
3eba2519
1 commit,
Sep 9, 2020
1 file
+
3
−
3
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/main/java/nl/tudelft/ewi/queue/service/PermissionService.java
+
3
−
3
View file @ 3eba2519
Edit in single-file editor
Open in Web IDE
Show full file
@@ -102,14 +102,14 @@ public class PermissionService {
public
boolean
canUpdateParticipant
(
Object
principal
,
Long
courseId
,
Long
participantId
)
{
User
user
=
getUser
(
principal
);
User
participant
=
getRole
(
participantId
)
.
getUser
()
;
Role
participant
Role
=
getRole
(
participantId
);
Course
course
=
courseRepository
.
findByIdOrThrow
(
courseId
);
return
user
.
isAdmin
()
||
user
.
teaches
(
course
)
||
user
.
manages
(
course
)
&&
!
participant
.
teaches
(
course
)
||
participant
.
getId
().
equals
(
user
.
getId
());
user
.
manages
(
course
)
&&
!
(
participant
Role
instanceof
Teacher
)
||
participant
Role
.
getUser
()
.
getId
().
equals
(
user
.
getId
());
}
public
boolean
canAddParticipant
(
Object
principal
,
Long
courseId
,
String
participantRole
)
{
Loading