Simplify security model.
This commit is contained in:
@@ -5,7 +5,6 @@ import com.wisemapping.exceptions.WiseMappingException;
|
||||
import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.security.Utils;
|
||||
import org.codehaus.jackson.annotate.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -75,7 +74,7 @@ public class RestMindmap {
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return mindmap.getCreator();
|
||||
return mindmap.getCreator().getEmail();
|
||||
}
|
||||
|
||||
public String getLastModifierUser() {
|
||||
@@ -132,7 +131,7 @@ public class RestMindmap {
|
||||
}
|
||||
|
||||
public String getOwner() {
|
||||
final User owner = mindmap.getOwner();
|
||||
final User owner = mindmap.getCreator();
|
||||
return owner != null ? owner.getEmail() : null;
|
||||
}
|
||||
|
||||
|
@@ -1,9 +1,11 @@
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
|
||||
import com.wisemapping.model.Collaboration;
|
||||
import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.security.Utils;
|
||||
import org.codehaus.jackson.annotate.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -69,16 +71,20 @@ public class RestMindmapInfo {
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return mindmap.getCreator();
|
||||
return mindmap.getCreator().getUsername();
|
||||
}
|
||||
|
||||
public String getOwnerEmail() {
|
||||
return mindmap.getOwner().getEmail();
|
||||
public void setCreator() {
|
||||
// Do nothing ...
|
||||
}
|
||||
|
||||
public String getOwner() {
|
||||
final User owner = mindmap.getOwner();
|
||||
return owner.getUsername();
|
||||
public String getRole() {
|
||||
final Collaboration collaboration = mindmap.findCollaboration(Utils.getUser());
|
||||
return collaboration != null ? collaboration.getRole().getLabel() : "none";
|
||||
}
|
||||
|
||||
public void setRole() {
|
||||
// Do nothing ...
|
||||
}
|
||||
|
||||
public String getLastModifierUser() {
|
||||
@@ -117,7 +123,7 @@ public class RestMindmapInfo {
|
||||
mindmap.setDescription(description);
|
||||
}
|
||||
|
||||
public void setCreator(String creatorUser) {
|
||||
public void setCreator(String email) {
|
||||
|
||||
}
|
||||
|
||||
@@ -127,12 +133,6 @@ public class RestMindmapInfo {
|
||||
public void setLastModifierUser(String value) {
|
||||
}
|
||||
|
||||
public void setOwnerEmail(String value) {
|
||||
}
|
||||
|
||||
public void setOwner(String value) {
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public MindMap getDelegated() {
|
||||
return this.mindmap;
|
||||
|
@@ -78,7 +78,7 @@ public class RestUser {
|
||||
return user.getId();
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
public void setId(int id) {
|
||||
user.setId(id);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user