diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java index da86633b..8dba8df1 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java @@ -462,6 +462,20 @@ public class MindmapController extends BaseController { mindmapService.updateCollaboration(user, collaboration.get()); } + @RequestMapping(method = RequestMethod.GET, value = "/maps/{id}/starred", produces = {"text/plain"}) + @ResponseBody + public String fetchStarred(@PathVariable int id) throws WiseMappingException { + final Mindmap mindmap = findMindmapById(id); + final User user = Utils.getUser(); + + final Optional collaboration = mindmap.findCollaboration(user); + if (!collaboration.isPresent()) { + throw new WiseMappingException("No enough permissions."); + } + boolean result = collaboration.get().getCollaborationProperties().getStarred(); + return Boolean.toString(result); + } + @RequestMapping(method = RequestMethod.DELETE, value = "/maps/batch") @ResponseStatus(value = HttpStatus.NO_CONTENT) public void batchDelete(@RequestParam() String ids) throws IOException, WiseMappingException { diff --git a/wise-webapp/src/test/java/com/wisemapping/test/rest/RestMindmapITCase.java b/wise-webapp/src/test/java/com/wisemapping/test/rest/RestMindmapITCase.java index cf4f2586..72334816 100644 --- a/wise-webapp/src/test/java/com/wisemapping/test/rest/RestMindmapITCase.java +++ b/wise-webapp/src/test/java/com/wisemapping/test/rest/RestMindmapITCase.java @@ -227,7 +227,7 @@ public class RestMindmapITCase { Optional mindmapInfo = fetchMap(requestHeaders, template, mapId); // @todo: Enforce check... -// assertTrue(mindmapInfo.get().getStarred() == true); + assertTrue(mindmapInfo.get().getStarred() == true); } @Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")