From ed6d89fb7e75aa00e8a5ef5ce35977840c4a236e Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sun, 24 Mar 2013 16:58:18 -0300 Subject: [PATCH] Admin can delete maps. --- .../java/com/wisemapping/service/MindmapServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wise-webapp/src/main/java/com/wisemapping/service/MindmapServiceImpl.java b/wise-webapp/src/main/java/com/wisemapping/service/MindmapServiceImpl.java index dae1beaa..08250564 100755 --- a/wise-webapp/src/main/java/com/wisemapping/service/MindmapServiceImpl.java +++ b/wise-webapp/src/main/java/com/wisemapping/service/MindmapServiceImpl.java @@ -65,7 +65,7 @@ public class MindmapServiceImpl public boolean hasPermissions(@Nullable User user, @Nullable Mindmap map, @NotNull CollaborationRole role) { boolean result = false; if (map != null) { - if ((map.isPublic() && role == CollaborationRole.VIEWER) || (isAdmin(user) && role == CollaborationRole.VIEWER)) { + if ((map.isPublic() && role == CollaborationRole.VIEWER) || isAdmin(user)) { result = true; } else if (user != null) { final Collaboration collaboration = map.findCollaboration(user); @@ -109,11 +109,11 @@ public class MindmapServiceImpl try { xml = mindMap.getXmlStr().trim(); } catch (UnsupportedEncodingException e) { - throw new WiseMappingException("Could not be decoded.",e); + throw new WiseMappingException("Could not be decoded.", e); } if (!xml.endsWith("")) { - throw new WiseMappingException("Map seems not to be a valid mindmap: '"+xml +"'"); + throw new WiseMappingException("Map seems not to be a valid mindmap: '" + xml + "'"); } mindmapManager.updateMindmap(mindMap, saveHistory); @@ -142,7 +142,7 @@ public class MindmapServiceImpl @Override public void removeMindmap(@NotNull Mindmap mindmap, @NotNull User user) throws WiseMappingException { - if (mindmap.getCreator().identityEquality(user)) { + if (mindmap.getCreator().identityEquality(user) || isAdmin(user)) { mindmapManager.removeMindmap(mindmap); } else { final Collaboration collaboration = mindmap.findCollaboration(user);