Skip to content
Snippets Groups Projects
Commit ed846218 authored by ThanKarab's avatar ThanKarab
Browse files

Logs added.

parent a12ad32a
No related branches found
No related tags found
1 merge request!11Dev role with underscore not working
...@@ -50,13 +50,13 @@ public class ClaimUtils { ...@@ -50,13 +50,13 @@ public class ClaimUtils {
List<PathologyDTO> allPathologies) { List<PathologyDTO> allPathologies) {
// --- Providing only the allowed pathologies/datasets to the user --- // --- Providing only the allowed pathologies/datasets to the user ---
UserActionLogging.LogUserAction(username, UserActionLogging.LogUserAction(username,
"Load all the pathologies", "Filter out the unauthorised datasets."); "Load pathologies", "Filter out the unauthorised datasets.");
List<String> userClaims = Arrays.asList(authorities.toString().toLowerCase() List<String> userClaims = Arrays.asList(authorities.toString().toLowerCase()
.replaceAll("[\\s+\\]\\[]", "").split(",")); .replaceAll("[\\s+\\]\\[]", "").split(","));
UserActionLogging.LogUserAction(username, UserActionLogging.LogUserAction(username,
"Load all the pathologies", "User Claims: " + userClaims); "Load pathologies", "User Claims: " + userClaims);
// If the "dataset_all" claim exists then return everything // If the "dataset_all" claim exists then return everything
if (userClaims.contains(ClaimUtils.allDatasetsAllowedClaim())) { if (userClaims.contains(ClaimUtils.allDatasetsAllowedClaim())) {
...@@ -66,18 +66,26 @@ public class ClaimUtils { ...@@ -66,18 +66,26 @@ public class ClaimUtils {
List<PathologyDTO> userPathologies = new ArrayList<>(); List<PathologyDTO> userPathologies = new ArrayList<>();
for (PathologyDTO curPathology : allPathologies) { for (PathologyDTO curPathology : allPathologies) {
UserActionLogging.LogUserAction(username, UserActionLogging.LogUserAction(username,
"Load all the pathologies", "Pathology: " + curPathology.getCode()); "Load pathologies", "Pathology: " + curPathology.getCode());
List<PathologyDTO.PathologyDatasetDTO> userPathologyDatasets = new ArrayList<PathologyDTO.PathologyDatasetDTO>(); List<PathologyDTO.PathologyDatasetDTO> userPathologyDatasets = new ArrayList<PathologyDTO.PathologyDatasetDTO>();
for (PathologyDTO.PathologyDatasetDTO dataset : curPathology.getDatasets()) { for (PathologyDTO.PathologyDatasetDTO dataset : curPathology.getDatasets()) {
if (userClaims.contains(ClaimUtils.getDatasetClaim(dataset.getCode()))) { if (userClaims.contains(ClaimUtils.getDatasetClaim(dataset.getCode()))) {
UserActionLogging.LogUserAction(username, "Load pathologies",
"Added dataset: " + dataset.getCode());
userPathologyDatasets.add(dataset); userPathologyDatasets.add(dataset);
}else{
UserActionLogging.LogUserAction(username, "Load pathologies",
"Dataset not added: '" + dataset.getCode());
UserActionLogging.LogUserAction(username, "Load pathologies",
"Claim did not exist: '" + ClaimUtils.getDatasetClaim(dataset.getCode()));
} }
} }
if (userPathologyDatasets.size() > 0) { if (userPathologyDatasets.size() > 0) {
UserActionLogging.LogUserAction(username, "Load all the pathologies", UserActionLogging.LogUserAction(username, "Load pathologies",
"Added pathology '" + curPathology.getLabel() + " with datasets: '" + userPathologyDatasets + "'"); "Added pathology '" + curPathology.getLabel()
+ " with datasets: '" + userPathologyDatasets + "'");
PathologyDTO userPathology = new PathologyDTO(); PathologyDTO userPathology = new PathologyDTO();
userPathology.setCode(curPathology.getCode()); userPathology.setCode(curPathology.getCode());
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment