Compare commits
41 Commits
9
pom.xml
9
pom.xml
|
@ -1,14 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>uoa-monitor-service</artifactId>
|
||||
<version>1.0.4-SNAPSHOT</version>
|
||||
<version>1.1.13-BETA-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
<name>uoa-monitor-service</name>
|
||||
<scm>
|
||||
<developerConnection>scm:git:gitea@code-repo.d4science.org:MaDgIK/uoa-monitor-service.git</developerConnection>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
<parent>
|
||||
<groupId>eu.dnetlib</groupId>
|
||||
|
@ -30,7 +29,7 @@
|
|||
<dependency> <!-- this dependency includes dependency to uoa-authorization-library -->
|
||||
<groupId>eu.dnetlib</groupId>
|
||||
<artifactId>uoa-admin-tools-library</artifactId>
|
||||
<version>1.0.12</version>
|
||||
<version>1.0.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>eu.dnetlib</groupId>
|
||||
|
|
|
@ -234,6 +234,8 @@ function uniqueIndexes() {
|
|||
db.stakeholder.createIndex( { "alias": 1 }, { unique: true } );
|
||||
}
|
||||
|
||||
// use monitordb;
|
||||
|
||||
upperCaseEnumValues();
|
||||
addHeightInIndicators();
|
||||
addVisibility();
|
||||
|
|
|
@ -52,6 +52,8 @@ function addFooterHelpTextForPortalType(portalType) {
|
|||
}
|
||||
}
|
||||
|
||||
// use monitordb;
|
||||
|
||||
addHomePageInPortalType("funder");
|
||||
addFooterDivIdForPortalType("funder");
|
||||
addFooterHelpTextForPortalType("funder");
|
||||
|
|
|
@ -176,5 +176,7 @@ function addFundingStreamInDefaultMSCA() {
|
|||
}
|
||||
}
|
||||
|
||||
// use monitordb;
|
||||
|
||||
statsProfileOfIndicatorsAsVariable();
|
||||
addFundingStreamInDefaultMSCA();
|
||||
|
|
|
@ -12,12 +12,5 @@ function deleteIndexParameters() {
|
|||
})
|
||||
}
|
||||
|
||||
function addCopyWithDefaultValue() {
|
||||
/* Set default profiles with copy: false */
|
||||
db.stakeholder.updateMany({defaultId: null, copy: {$exists: false}}, {$set: {copy: false}});
|
||||
/* Set not default profiles with copy: true */
|
||||
db.stakeholder.updateMany({defaultId: {$ne: null}, copy: {$exists: false}}, {$set: {copy: true}});
|
||||
}
|
||||
|
||||
// use irish-prod;
|
||||
deleteIndexParameters();
|
||||
addCopyWithDefaultValue();
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package eu.dnetlib.uoamonitorservice.controllers;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.handlers.ForbiddenException;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.services.PortalService;
|
||||
import eu.dnetlib.uoamonitorservice.dto.StakeholderFull;
|
||||
import eu.dnetlib.uoamonitorservice.dto.copy;
|
||||
import eu.dnetlib.uoamonitorservice.dto.StakeholderFull;
|
||||
import eu.dnetlib.uoamonitorservice.entities.Stakeholder;
|
||||
import eu.dnetlib.uoamonitorservice.generics.StakeholderGeneric;
|
||||
import eu.dnetlib.uoamonitorservice.primitives.Visibility;
|
||||
import eu.dnetlib.uoamonitorservice.service.CommonService;
|
||||
import eu.dnetlib.uoamonitorservice.service.StakeholderService;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
@ -15,6 +16,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(origins = "*")
|
||||
|
@ -23,13 +25,11 @@ public class StakeholderController {
|
|||
|
||||
private final PortalService portalService;
|
||||
private final StakeholderService stakeholderService;
|
||||
private final CommonService commonService;
|
||||
|
||||
@Autowired
|
||||
public StakeholderController(PortalService portalService, StakeholderService stakeholderService, CommonService commonService) {
|
||||
public StakeholderController(PortalService portalService, StakeholderService stakeholderService) {
|
||||
this.portalService = portalService;
|
||||
this.stakeholderService = stakeholderService;
|
||||
this.commonService = commonService;
|
||||
}
|
||||
|
||||
@PreAuthorize("isAuthenticated()")
|
||||
|
@ -89,7 +89,7 @@ public class StakeholderController {
|
|||
public StakeholderFull getStakeholder(@PathVariable("alias") String alias) {
|
||||
StakeholderFull stakeholder = this.stakeholderService.getFullStakeholder(this.stakeholderService.findByAlias(alias));
|
||||
if (stakeholder == null) {
|
||||
this.commonService.unauthorized("Get stakeholder: You are not authorized to access stakeholder with alias: " + alias);
|
||||
throw new ForbiddenException("Get stakeholder: You are not authorized to access stakeholder with alias: " + alias);
|
||||
}
|
||||
return stakeholder;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public class CategoryService {
|
|||
this.updateChildren(category);
|
||||
category = this.save(category);
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to update stakeholder with id: " + stakeholder.getId());
|
||||
throw new ForbiddenException("You are not authorized to update stakeholder with id: " + stakeholder.getId());
|
||||
}
|
||||
} else {
|
||||
if (this.commonService.hasCreateAuthority(stakeholder.getType())) {
|
||||
|
@ -113,7 +113,7 @@ public class CategoryService {
|
|||
}
|
||||
this.addCategory(topic, category.getId());
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to create a category in stakeholder with id: " + stakeholder.getId());
|
||||
throw new ForbiddenException("You are not authorized to create a category in stakeholder with id: " + stakeholder.getId());
|
||||
}
|
||||
}
|
||||
return this.getFullCategory(stakeholder.getType(), stakeholder.getAlias(), category);
|
||||
|
@ -145,9 +145,8 @@ public class CategoryService {
|
|||
throw new EntityNotFoundException("Some subCategories dont exist in the category with id " + category.getId());
|
||||
}
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to reorder subCategories in category with id: " + category.getId());
|
||||
throw new ForbiddenException("You are not authorized to reorder subCategories in category with id: " + category.getId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void reorderChildren(Stakeholder defaultStakeholder, Category defaultCategory, List<String> defaultSubCategories) {
|
||||
|
@ -172,7 +171,7 @@ public class CategoryService {
|
|||
}
|
||||
this.dao.delete(category);
|
||||
} else {
|
||||
this.commonService.unauthorized("Delete category: You are not authorized to delete category with id: " + category.getId());
|
||||
throw new ForbiddenException("Delete category: You are not authorized to delete category with id: " + category.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,9 +205,8 @@ public class CategoryService {
|
|||
category.update(this.save(new Category(category)));
|
||||
return category;
|
||||
} else {
|
||||
this.commonService.unauthorized("Change category visibility: You are not authorized to update category with id: " + category.getId());
|
||||
throw new ForbiddenException("Change category visibility: You are not authorized to update category with id: " + category.getId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public CategoryFull changeVisibility(String type, String alias, Category category, Visibility visibility, Boolean propagate) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package eu.dnetlib.uoamonitorservice.service;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.handlers.ForbiddenException;
|
||||
import eu.dnetlib.uoaadmintoolslibrary.handlers.UnauthorizedException;
|
||||
import eu.dnetlib.uoaauthorizationlibrary.security.AuthorizationService;
|
||||
import eu.dnetlib.uoamonitorservice.dto.TopicFull;
|
||||
import eu.dnetlib.uoamonitorservice.generics.Common;
|
||||
|
@ -71,12 +69,4 @@ public class CommonService {
|
|||
});
|
||||
return ids;
|
||||
}
|
||||
|
||||
public void unauthorized(String message) {
|
||||
if(authorizationService.getAaiId() != null) {
|
||||
throw new ForbiddenException(message);
|
||||
} else {
|
||||
throw new UnauthorizedException(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package eu.dnetlib.uoamonitorservice.service;
|
||||
|
||||
import eu.dnetlib.uoaadmintoolslibrary.handlers.ForbiddenException;
|
||||
import eu.dnetlib.uoamonitorservice.dao.*;
|
||||
import eu.dnetlib.uoamonitorservice.entities.Indicator;
|
||||
import eu.dnetlib.uoamonitorservice.entities.Section;
|
||||
|
@ -81,7 +82,7 @@ public class IndicatorService {
|
|||
this.updateChildren(indicator);
|
||||
indicator = this.save(indicator);
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to update stakeholder with id: " + stakeholder.getId());
|
||||
throw new ForbiddenException("You are not authorized to update stakeholder with id: " + stakeholder.getId());
|
||||
}
|
||||
} else {
|
||||
if (this.commonService.hasCreateAuthority(stakeholder.getType())) {
|
||||
|
@ -89,7 +90,7 @@ public class IndicatorService {
|
|||
this.createChildren(section, indicator);
|
||||
this.addIndicator(section, indicator.getId());
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to create an indicator in stakeholder with id: " + stakeholder.getId());
|
||||
throw new ForbiddenException("You are not authorized to create an indicator in stakeholder with id: " + stakeholder.getId());
|
||||
}
|
||||
}
|
||||
return indicator;
|
||||
|
@ -127,7 +128,7 @@ public class IndicatorService {
|
|||
}
|
||||
this.dao.delete(indicator);
|
||||
} else {
|
||||
this.commonService.unauthorized("Delete indicator: You are not authorized to delete indicator with id: " + indicator.getId());
|
||||
throw new ForbiddenException("Delete indicator: You are not authorized to delete indicator with id: " + indicator.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,8 +157,7 @@ public class IndicatorService {
|
|||
indicator.setVisibility(visibility);
|
||||
return this.save(indicator);
|
||||
} else {
|
||||
this.commonService.unauthorized("Change section visibility: You are not authorized to update section with id: " + indicator.getId());
|
||||
throw new ForbiddenException("Change section visibility: You are not authorized to update section with id: " + indicator.getId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ public class SectionService {
|
|||
this.createChildren(subCategory, new Section(section), -1);
|
||||
});
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to create sections in stakeholder with id: " + stakeholder.getId());
|
||||
throw new ForbiddenException("You are not authorized to create sections in stakeholder with id: " + stakeholder.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class SectionService {
|
|||
this.updateChildren(section);
|
||||
section = this.save(section);
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to update stakeholder with id: " + stakeholder.getId());
|
||||
throw new ForbiddenException("You are not authorized to update stakeholder with id: " + stakeholder.getId());
|
||||
}
|
||||
} else {
|
||||
if (this.commonService.hasCreateAuthority(stakeholder.getType())) {
|
||||
|
@ -123,7 +123,7 @@ public class SectionService {
|
|||
this.createChildren(subCategory, section, index);
|
||||
this.addSection(subCategory, section.getId(), index);
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to create a section in stakeholder with id: " + stakeholder.getId());
|
||||
throw new ForbiddenException("You are not authorized to create a section in stakeholder with id: " + stakeholder.getId());
|
||||
}
|
||||
}
|
||||
return this.getFullSection(stakeholder.getType(), stakeholder.getAlias(), section);
|
||||
|
@ -168,9 +168,8 @@ public class SectionService {
|
|||
throw new EntityNotFoundException("Some indicators dont exist in the section with id " + section.getId());
|
||||
}
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to reorder indicators in section with id: " + section.getId());
|
||||
throw new ForbiddenException("You are not authorized to reorder indicators in section with id: " + section.getId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void reorderChildren(Stakeholder defaultStakeholder, Section defaultSection, List<String> defaultIndicators) {
|
||||
|
@ -195,7 +194,7 @@ public class SectionService {
|
|||
}
|
||||
this.dao.delete(section);
|
||||
} else {
|
||||
this.commonService.unauthorized("Delete section: You are not authorized to delete section with id: " + section.getId());
|
||||
throw new ForbiddenException("Delete section: You are not authorized to delete section with id: " + section.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,8 +238,7 @@ public class SectionService {
|
|||
section.update(this.save(new Section(section)));
|
||||
return section;
|
||||
} else {
|
||||
this.commonService.unauthorized("Change section visibility: You are not authorized to update section with id: " + section.getId());
|
||||
throw new ForbiddenException("Change section visibility: You are not authorized to update section with id: " + section.getId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class StakeholderService {
|
|||
}
|
||||
|
||||
public Stakeholder findByPath(String stakeholderId) {
|
||||
if (stakeholderId.equals("-1")) {
|
||||
if(stakeholderId.equals("-1")) {
|
||||
return null;
|
||||
}
|
||||
return dao.findById(stakeholderId).orElseThrow(() -> new EntityNotFoundException("Stakeholder with id: " + stakeholderId + " not found"));
|
||||
|
@ -81,9 +81,10 @@ public class StakeholderService {
|
|||
}
|
||||
|
||||
public StakeholderFull getFullStakeholder(Stakeholder stakeholder) {
|
||||
if (!stakeholder.isCopy() && stakeholder.getDefaultId() != null) {
|
||||
if (this.commonService.hasVisibilityAuthority(stakeholder.getType(), stakeholder.getAlias(), stakeholder)) {
|
||||
if(!stakeholder.isCopy() && stakeholder.getDefaultId() != null) {
|
||||
Stakeholder defaultStakeholder = this.findByPath(stakeholder.getDefaultId());
|
||||
if (defaultStakeholder != null) {
|
||||
if(defaultStakeholder != null) {
|
||||
return new StakeholderFull(stakeholder,
|
||||
defaultStakeholder.getTopics().stream()
|
||||
.map(topicId -> topicService.getFullTopic(stakeholder.getType(), stakeholder.getAlias(), topicId))
|
||||
|
@ -94,12 +95,15 @@ public class StakeholderService {
|
|||
stakeholder.getTopics().stream()
|
||||
.map(topicId -> topicService.getFullTopic(stakeholder.getType(), stakeholder.getAlias(), topicId))
|
||||
.collect(Collectors.toList()));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Stakeholder buildStakeholder(Stakeholder stakeholder, String copyId) {
|
||||
if (stakeholder.getDefaultId() == null) {
|
||||
if(stakeholder.getDefaultId() == null) {
|
||||
stakeholder.setCopy(false);
|
||||
if (copyId == null) {
|
||||
if(copyId == null) {
|
||||
stakeholder.setTopics(new ArrayList<>());
|
||||
} else {
|
||||
Stakeholder copyFrom = this.findByPath(copyId);
|
||||
|
@ -107,9 +111,9 @@ public class StakeholderService {
|
|||
}
|
||||
} else {
|
||||
stakeholder.setTopics(new ArrayList<>());
|
||||
if (stakeholder.isCopy()) {
|
||||
if(stakeholder.isCopy()) {
|
||||
Stakeholder defaultStakeholder = this.findByPath(stakeholder.getDefaultId());
|
||||
if (defaultStakeholder != null) {
|
||||
if(defaultStakeholder != null) {
|
||||
stakeholder.setTopics(defaultStakeholder.getTopics().stream().map(this.topicService::build).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
|
@ -127,9 +131,9 @@ public class StakeholderService {
|
|||
});
|
||||
stakeholder.setTopics(new ArrayList<>());
|
||||
} else {
|
||||
if (old.getTopics().isEmpty() && old.getDefaultId() != null) {
|
||||
if(old.getTopics().isEmpty() && old.getDefaultId() != null) {
|
||||
Stakeholder defaultStakeholder = this.findByPath(stakeholder.getDefaultId());
|
||||
if (defaultStakeholder != null) {
|
||||
if(defaultStakeholder != null) {
|
||||
stakeholder.setTopics(defaultStakeholder.getTopics().stream().map(this.topicService::build).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
|
@ -154,9 +158,8 @@ public class StakeholderService {
|
|||
throw new EntityNotFoundException("Some topics dont exist in the stakeholder with id " + stakeholder.getId());
|
||||
}
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to reorder topics in stakeholder with id: " + stakeholder.getId());
|
||||
throw new ForbiddenException("You are not authorized to reorder topics in stakeholder with id: " + stakeholder.getId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void reorderChildren(Stakeholder defaultStakeholder, List<String> defaultTopics) {
|
||||
|
@ -178,9 +181,8 @@ public class StakeholderService {
|
|||
this.dao.delete(id);
|
||||
return stakeholder.getAlias();
|
||||
} else {
|
||||
this.commonService.unauthorized("Delete stakeholder: You are not authorized to delete stakeholder with id: " + id);
|
||||
throw new ForbiddenException("Delete stakeholder: You are not authorized to delete stakeholder with id: " + id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public StakeholderFull changeVisibility(StakeholderFull stakeholder, Visibility visibility, Boolean propagate) {
|
||||
|
@ -194,9 +196,8 @@ public class StakeholderService {
|
|||
stakeholder.update(this.save(new Stakeholder(stakeholder)));
|
||||
return stakeholder;
|
||||
} else {
|
||||
this.commonService.unauthorized("Change stakeholder visibility: You are not authorized to update stakeholder with id: " + stakeholder.getId());
|
||||
throw new ForbiddenException("Change stakeholder visibility: You are not authorized to update stakeholder with id: " + stakeholder.getId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public StakeholderFull changeVisibility(Stakeholder stakeholder, Visibility visibility, Boolean propagate) {
|
||||
|
|
|
@ -112,7 +112,7 @@ public class SubCategoryService {
|
|||
this.updateChildren(subCategory);
|
||||
subCategory = this.save(subCategory);
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to update stakeholder with id: " + stakeholder.getId());
|
||||
throw new ForbiddenException("You are not authorized to update stakeholder with id: " + stakeholder.getId());
|
||||
}
|
||||
} else {
|
||||
if (this.commonService.hasCreateAuthority(stakeholder.getType())) {
|
||||
|
@ -120,7 +120,7 @@ public class SubCategoryService {
|
|||
this.createChildren(category, subCategory);
|
||||
this.addSubCategory(category, subCategory.getId());
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to create a subCategory in stakeholder with id: " + stakeholder.getId());
|
||||
throw new ForbiddenException("You are not authorized to create a subCategory in stakeholder with id: " + stakeholder.getId());
|
||||
}
|
||||
}
|
||||
return this.getFullSubCategory(stakeholder.getType(), stakeholder.getAlias(), subCategory);
|
||||
|
@ -153,9 +153,8 @@ public class SubCategoryService {
|
|||
this.moveIndicatorChildren(stakeholder, subCategory, moveIndicator);
|
||||
return this.getFullSubCategory(stakeholder.getType(), stakeholder.getAlias(), subCategory);
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to move indicators in subCategory with id: " + subCategory.getId());
|
||||
throw new ForbiddenException("You are not authorized to move indicators in subCategory with id: " + subCategory.getId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void moveIndicatorChildren(Stakeholder defaultStakeholder, SubCategory defaultSubCategory, MoveIndicator moveIndicator) {
|
||||
|
@ -192,9 +191,8 @@ public class SubCategoryService {
|
|||
throw new EntityNotFoundException("Some sections dont exist in the subCategory with id " + subCategory.getId());
|
||||
}
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to reorder sections in subCategory with id: " + subCategory.getId());
|
||||
throw new ForbiddenException("You are not authorized to reorder sections in subCategory with id: " + subCategory.getId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public SubCategoryFull reorderCharts(Stakeholder stakeholder, SubCategory subCategory, List<String> charts) {
|
||||
|
@ -208,9 +206,8 @@ public class SubCategoryService {
|
|||
throw new EntityNotFoundException("Some sections dont exist in the subCategory with id " + subCategory.getId());
|
||||
}
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to reorder sections in subCategory with id: " + subCategory.getId());
|
||||
throw new ForbiddenException("You are not authorized to reorder sections in subCategory with id: " + subCategory.getId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void reorderChildrenNumbers(Stakeholder defaultStakeholder, SubCategory defaultSubCategory, List<String> defaultSections) {
|
||||
|
@ -248,7 +245,7 @@ public class SubCategoryService {
|
|||
}
|
||||
this.dao.delete(subCategory);
|
||||
} else {
|
||||
this.commonService.unauthorized("Delete subCategory: You are not authorized to delete subCategory with id: " + subCategory.getId());
|
||||
throw new ForbiddenException("Delete subCategory: You are not authorized to delete subCategory with id: " + subCategory.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -285,9 +282,8 @@ public class SubCategoryService {
|
|||
subCategory.update(this.save(new SubCategory(subCategory)));
|
||||
return subCategory;
|
||||
} else {
|
||||
this.commonService.unauthorized("Change subCategory visibility: You are not authorized to update subCategory with id: " + subCategory.getId());
|
||||
throw new ForbiddenException("Change subCategory visibility: You are not authorized to update subCategory with id: " + subCategory.getId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public SubCategoryFull changeVisibility(String type, String alias, SubCategory subCategory, Visibility visibility, Boolean propagate) {
|
||||
|
|
|
@ -94,7 +94,7 @@ public class TopicService {
|
|||
this.updateChildren(topic);
|
||||
topic = this.save(topic);
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to update stakeholder with id: " + stakeholder.getId());
|
||||
throw new ForbiddenException("You are not authorized to update stakeholder with id: " + stakeholder.getId());
|
||||
}
|
||||
} else {
|
||||
if(this.commonService.hasCreateAuthority(stakeholder.getType())) {
|
||||
|
@ -102,7 +102,7 @@ public class TopicService {
|
|||
this.createChildren(stakeholder, topic);
|
||||
this.addTopic(stakeholder, topic.getId());
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to create a topic in stakeholder with id: " + stakeholder.getId());
|
||||
throw new ForbiddenException("You are not authorized to create a topic in stakeholder with id: " + stakeholder.getId());
|
||||
}
|
||||
}
|
||||
return this.getFullTopic(stakeholder.getType(), stakeholder.getAlias(), topic);
|
||||
|
@ -132,9 +132,8 @@ public class TopicService {
|
|||
throw new EntityNotFoundException("Some categories dont exist in the topic with id " + topic.getId());
|
||||
}
|
||||
} else {
|
||||
this.commonService.unauthorized("You are not authorized to reorder categories in topic with id: " + topic.getId());
|
||||
throw new ForbiddenException("You are not authorized to reorder categories in topic with id: " + topic.getId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void reorderChildren(Stakeholder defaultStakeholder, Topic defaultTopic, List<String> defaultCategories) {
|
||||
|
@ -159,7 +158,7 @@ public class TopicService {
|
|||
}
|
||||
this.dao.delete(topic);
|
||||
} else {
|
||||
this.commonService.unauthorized("Delete topic: You are not authorized to delete topic with id: " + topic.getId());
|
||||
throw new ForbiddenException("Delete topic: You are not authorized to delete topic with id: " + topic.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,9 +192,8 @@ public class TopicService {
|
|||
topic.update(this.save(new Topic(topic)));
|
||||
return topic;
|
||||
} else {
|
||||
this.commonService.unauthorized("Change topic visibility: You are not authorized to update topic with id: " + topic.getId());
|
||||
throw new ForbiddenException("Change topic visibility: You are not authorized to update topic with id: " + topic.getId());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public TopicFull changeVisibility(String type, String alias, Topic topic, Visibility visibility, Boolean propagate) {
|
||||
|
|
Loading…
Reference in New Issue