Skip to content
Snippets Groups Projects
Commit 4b6a9990 authored by Ruben Backx's avatar Ruben Backx :coffee:
Browse files

Merge branch 'dev' into 'master'

Add all programmes to admin coordinator page

See merge request !284
parents 13ac11d6 7994904f
No related branches found
No related tags found
No related merge requests found
Pipeline #895349 failed
......@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
### Changed
### Fixed
## [2.1.3]
### Added
- Admins and programme coordinators can now add or remove TA coordinators. @rwbackx
......
......
......@@ -4,7 +4,7 @@ import nl.javadude.gradle.plugins.license.DownloadLicensesExtension
import nl.javadude.gradle.plugins.license.LicenseExtension
group = "nl.tudelft.tam"
version = "2.1.2"
version = "2.1.3"
val javaVersion = JavaVersion.VERSION_17
......
......
......@@ -22,8 +22,10 @@ import java.util.List;
import nl.tudelft.labracore.api.ProgramControllerApi;
import nl.tudelft.labracore.api.dto.ProgramDetailsDTO;
import nl.tudelft.labracore.api.dto.ProgramSummaryDTO;
import nl.tudelft.labracore.lib.security.user.DefaultRole;
import nl.tudelft.tam.repository.CoordinatorRepository;
import nl.tudelft.tam.security.AuthorisationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -36,6 +38,9 @@ public class ProgramService {
@Autowired
private CoordinatorRepository coordinatorRepository;
@Autowired
private AuthorisationService authorisationService;
/**
* Get a program by id
*
......@@ -68,7 +73,9 @@ public class ProgramService {
* @return All program details coordinated
*/
public List<ProgramDetailsDTO> getCoordinatingPrograms(Long coordinatorId) {
return coordinatorRepository.findAllByPersonId(coordinatorId).stream()
return authorisationService.getAuthPerson().getDefaultRole() == DefaultRole.ADMIN ?
programApi.getAllProgramsById(programApi.getAllPrograms().map(ProgramSummaryDTO::getId).collectList().block()).collectList().block():
coordinatorRepository.findAllByPersonId(coordinatorId).stream()
.map(c -> programApi.getProgramById(c.getProgramId()).block()).toList();
}
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment