Remove username attribute
This commit is contained in:
@@ -58,16 +58,6 @@ public class AdminController extends BaseController {
|
||||
return new ModelAndView("userView", "user", new RestUser(user));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "admin/users/username/{username}", produces = {"application/json", "text/html", "application/xml"})
|
||||
@ResponseBody
|
||||
public ModelAndView getUserByUsername(@PathVariable String username) throws IOException {
|
||||
final User user = userService.getUserByUsername(username);
|
||||
if (user == null) {
|
||||
throw new IllegalArgumentException("User '" + username + "' could not be found");
|
||||
}
|
||||
return new ModelAndView("userView", "user", new RestUser(user));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = "admin/users", consumes = {"application/xml", "application/json"}, produces = {"application/json", "text/html", "application/xml"})
|
||||
@ResponseStatus(value = HttpStatus.CREATED)
|
||||
public void createUser(@RequestBody RestUser user, HttpServletResponse response) throws IOException, WiseMappingException {
|
||||
@@ -81,15 +71,6 @@ public class AdminController extends BaseController {
|
||||
throw new IllegalArgumentException("User already exists with this email.");
|
||||
}
|
||||
|
||||
final String username = user.getUsername();
|
||||
if (username == null || username.isEmpty()) {
|
||||
throw new IllegalArgumentException("username can not be null");
|
||||
}
|
||||
|
||||
if (userService.getUserByUsername(username) != null) {
|
||||
throw new IllegalArgumentException("User already exists with this username.");
|
||||
}
|
||||
|
||||
// Run some other validations ...
|
||||
final User delegated = user.getDelegated();
|
||||
final String lastname = delegated.getLastname();
|
||||
|
@@ -438,7 +438,7 @@ public class MindmapController extends BaseController {
|
||||
private void saveMindmap(boolean minor, @NotNull final MindMap mindMap, @NotNull final User user) throws WiseMappingException {
|
||||
final Calendar now = Calendar.getInstance();
|
||||
mindMap.setLastModificationTime(now);
|
||||
mindMap.setLastModifierUser(user.getUsername());
|
||||
mindMap.setLastEditor(user);
|
||||
mindmapService.updateMindmap(mindMap, !minor);
|
||||
}
|
||||
|
||||
|
@@ -81,8 +81,8 @@ public class RestMindmap {
|
||||
return mindmap.getCreator().getEmail();
|
||||
}
|
||||
|
||||
public String getLastModifierUser() {
|
||||
return mindmap.getLastModifierUser();
|
||||
public Collaborator getLastModifierUser() {
|
||||
return mindmap.getLastEditor();
|
||||
}
|
||||
|
||||
public String getLastModificationTime() {
|
||||
|
@@ -44,7 +44,7 @@ public class RestMindmapHistory {
|
||||
public RestMindmapHistory(@NotNull MindMapHistory history) {
|
||||
this.id = history.getId();
|
||||
this.creation = history.getCreationTime();
|
||||
this.creator = history.getCreator();
|
||||
this.creator = history.getEditor().getFullName();
|
||||
}
|
||||
|
||||
public String getCreationTime() {
|
||||
|
@@ -88,7 +88,8 @@ public class RestMindmapInfo {
|
||||
}
|
||||
|
||||
public String getLastModifierUser() {
|
||||
return mindmap.getLastModifierUser();
|
||||
final User user = mindmap.getLastEditor();
|
||||
return user != null ? user.getFullName() : "unknown";
|
||||
}
|
||||
|
||||
public String getLastModificationTime() {
|
||||
|
@@ -66,14 +66,6 @@ public class RestUser {
|
||||
// return user.isActive();
|
||||
// }
|
||||
|
||||
public String getUsername() {
|
||||
return user.getUsername();
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
user.setUsername(username);
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return user.getId();
|
||||
}
|
||||
|
Reference in New Issue
Block a user