48 lines
1.8 KiB
Java
48 lines
1.8 KiB
Java
package eu.dnetlib.uoaadmintools.controllers;
|
|
|
|
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
|
|
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.*;
|
|
import eu.dnetlib.uoaadmintoolslibrary.services.PortalService;
|
|
import org.apache.log4j.Logger;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import java.util.*;
|
|
|
|
@RestController
|
|
@RequestMapping("/explore")
|
|
@CrossOrigin(origins = "*")
|
|
//@PreAuthorize("hasAnyAuthority(@AuthorizationService.SUPER_ADMIN, @AuthorizationService.PORTAL_ADMIN)")
|
|
public class ExploreController {
|
|
private final Logger log = Logger.getLogger(this.getClass());
|
|
|
|
@Autowired
|
|
private PortalService portalService;
|
|
|
|
// @PreAuthorize("hasAnyAuthority(@AuthorizationService.SUPER_ADMIN, @AuthorizationService.PORTAL_ADMIN)")
|
|
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
|
public PortalResponse updateExplore(@RequestBody Portal portal) {
|
|
PortalResponse portalResponse = portalService.updatePortal(portal);
|
|
return portalResponse;
|
|
}
|
|
|
|
// @PreAuthorize("hasAnyAuthority(@AuthorizationService.SUPER_ADMIN, @AuthorizationService.PORTAL_ADMIN)")
|
|
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
public PortalResponse insertExplore(@RequestBody Portal portal) {
|
|
PortalResponse portalResponse = portalService.insertPortal(portal);
|
|
return portalResponse;
|
|
}
|
|
|
|
// cannot handle MismatchingContent
|
|
// @PreAuthorize("hasAnyAuthority(@AuthorizationService.SUPER_ADMIN, @AuthorizationService.PORTAL_ADMIN)")
|
|
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
|
public Boolean deleteExplore(@RequestBody List<String> portals) throws Exception {
|
|
for (String id : portals) {
|
|
portalService.deletePortal(id);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|