mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 14:17:57 +01:00
Admin can delete maps.
This commit is contained in:
parent
3b47ed2e52
commit
ed6d89fb7e
@ -65,7 +65,7 @@ public class MindmapServiceImpl
|
|||||||
public boolean hasPermissions(@Nullable User user, @Nullable Mindmap map, @NotNull CollaborationRole role) {
|
public boolean hasPermissions(@Nullable User user, @Nullable Mindmap map, @NotNull CollaborationRole role) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
if ((map.isPublic() && role == CollaborationRole.VIEWER) || (isAdmin(user) && role == CollaborationRole.VIEWER)) {
|
if ((map.isPublic() && role == CollaborationRole.VIEWER) || isAdmin(user)) {
|
||||||
result = true;
|
result = true;
|
||||||
} else if (user != null) {
|
} else if (user != null) {
|
||||||
final Collaboration collaboration = map.findCollaboration(user);
|
final Collaboration collaboration = map.findCollaboration(user);
|
||||||
@ -109,11 +109,11 @@ public class MindmapServiceImpl
|
|||||||
try {
|
try {
|
||||||
xml = mindMap.getXmlStr().trim();
|
xml = mindMap.getXmlStr().trim();
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
throw new WiseMappingException("Could not be decoded.",e);
|
throw new WiseMappingException("Could not be decoded.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!xml.endsWith("</map>")) {
|
if (!xml.endsWith("</map>")) {
|
||||||
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);
|
mindmapManager.updateMindmap(mindMap, saveHistory);
|
||||||
@ -142,7 +142,7 @@ public class MindmapServiceImpl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeMindmap(@NotNull Mindmap mindmap, @NotNull User user) throws WiseMappingException {
|
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);
|
mindmapManager.removeMindmap(mindmap);
|
||||||
} else {
|
} else {
|
||||||
final Collaboration collaboration = mindmap.findCollaboration(user);
|
final Collaboration collaboration = mindmap.findCollaboration(user);
|
||||||
|
Loading…
Reference in New Issue
Block a user