Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Zitrone44 committed Oct 30, 2024
2 parents 1ecacbc + 20423dd commit 976884f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ class GroupController{
val user = authService.authorize(req, res)
val someCourseRole = courseRegistrationService.getParticipants(cid).find(_.user.id == user.id).map(_.role)
(user.globalRole, someCourseRole) match {
case (GlobalRole.ADMIN | GlobalRole.MODERATOR, _) | (_, Some(CourseRole.DOCENT)) =>
val groupList = groupService.getAll(cid, ignoreHidden = false)
groupList
case _ => throw new ForbiddenException()
case (GlobalRole.ADMIN | GlobalRole.MODERATOR, _) | (_, Some(CourseRole.DOCENT)) => groupService.getAll(cid, ignoreHidden = false)
case _ => groupService.getAll(cid)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,8 @@ class GroupRegistrationController {
@GetMapping(value = Array("/courses/{cid}/groups/{gid}/participants"))
@ResponseBody
def getMembers(@PathVariable("cid") cid: Integer, @PathVariable("gid") gid: Int, req: HttpServletRequest, res: HttpServletResponse): List[Participant] = {
val user = authService.authorize(req, res)
val hasGlobalPrivileges = user.hasRole(GlobalRole.ADMIN, GlobalRole.MODERATOR)
val hasCoursePrivileges = courseRegistrationService.getCoursePrivileges(user.id).getOrElse(cid, CourseRole.STUDENT) == CourseRole.DOCENT
if (hasGlobalPrivileges || hasCoursePrivileges) {
groupRegistrationService.getMembers(cid, gid)
} else {
throw new ForbiddenException()
}
authService.authorize(req, res)
groupRegistrationService.getMembers(cid, gid)
}

/**
Expand Down

0 comments on commit 976884f

Please sign in to comment.