solving merge conflict
This commit is contained in:
@@ -19,7 +19,9 @@
|
||||
package com.wisemapping.rest;
|
||||
|
||||
import com.mangofactory.swagger.annotations.ApiIgnore;
|
||||
import com.wisemapping.exceptions.WiseMappingException;
|
||||
import com.wisemapping.mail.NotificationService;
|
||||
import com.wisemapping.model.Collaboration;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.rest.model.RestLogItem;
|
||||
@@ -39,6 +41,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
@Api(value="UserApi",description = "Account Account Related Objects.")
|
||||
@Controller
|
||||
@@ -76,7 +79,7 @@ public class AccountController extends BaseController {
|
||||
throw new IllegalArgumentException("Firstname can not be null");
|
||||
}
|
||||
|
||||
final User user = Utils.getUser();
|
||||
final User user = Utils.getUser(true);
|
||||
user.setFirstname(firstname);
|
||||
userService.updateUser(user);
|
||||
}
|
||||
@@ -88,7 +91,7 @@ public class AccountController extends BaseController {
|
||||
throw new IllegalArgumentException("lastname can not be null");
|
||||
|
||||
}
|
||||
final User user = Utils.getUser();
|
||||
final User user = Utils.getUser(true);
|
||||
user.setLastname(lastname);
|
||||
userService.updateUser(user);
|
||||
}
|
||||
@@ -106,6 +109,21 @@ public class AccountController extends BaseController {
|
||||
userService.updateUser(user);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "account")
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void deleteUser() throws WiseMappingException
|
||||
|
||||
{
|
||||
final User user = Utils.getUser(true);
|
||||
final List<Collaboration> collaborations = mindmapService.findCollaborations(user);
|
||||
for (Collaboration collaboration : collaborations) {
|
||||
final Mindmap mindmap = collaboration.getMindMap();
|
||||
mindmapService.removeMindmap(mindmap,user);
|
||||
}
|
||||
userService.removeUser(user);
|
||||
}
|
||||
|
||||
|
||||
@ApiIgnore
|
||||
@RequestMapping(method = RequestMethod.POST, value = "logger/editor", consumes = {"application/xml", "application/json"}, produces = {"application/json", "text/html", "application/xml"})
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
package com.wisemapping.rest;
|
||||
|
||||
import com.mangofactory.swagger.annotations.ApiModel;
|
||||
import com.wisemapping.exceptions.WiseMappingException;
|
||||
import com.wisemapping.model.AuthenticationType;
|
||||
import com.wisemapping.model.Collaboration;
|
||||
@@ -56,6 +55,7 @@ public class AdminController extends BaseController {
|
||||
@Qualifier("userService")
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Qualifier("mindmapService")
|
||||
@Autowired
|
||||
private MindmapService mindmapService;
|
||||
@@ -133,12 +133,19 @@ public class AdminController extends BaseController {
|
||||
@ApiOperation("Note: Administration permissions required.")
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "admin/users/{id}")
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void getUserByEmail(@PathVariable @ApiParam(required = true, allowableValues = "range[1," + Long.MAX_VALUE + "]") long id) throws WiseMappingException {
|
||||
public void deleteUserByEmail(@PathVariable long id) throws WiseMappingException {
|
||||
final User user = userService.getUserBy(id);
|
||||
if (user == null) {
|
||||
throw new IllegalArgumentException("User '" + id + "' could not be found");
|
||||
}
|
||||
userService.deleteUser(user);
|
||||
|
||||
final List<Collaboration> collaborations = mindmapService.findCollaborations(user);
|
||||
for (Collaboration collaboration : collaborations) {
|
||||
final Mindmap mindmap = collaboration.getMindMap();
|
||||
mindmapService.removeMindmap(mindmap,user);
|
||||
}
|
||||
|
||||
userService.removeUser(user);
|
||||
}
|
||||
|
||||
@ApiOperation("Note: Administration permissions required.")
|
||||
|
||||
Reference in New Issue
Block a user