mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-05 07:03:24 +01:00
Bug WISE-16 fixed. Backed completed.
This commit is contained in:
parent
86324c6873
commit
5f29024559
@ -18,7 +18,9 @@
|
|||||||
|
|
||||||
package com.wisemapping.rest;
|
package com.wisemapping.rest;
|
||||||
|
|
||||||
|
import com.wisemapping.exceptions.WiseMappingException;
|
||||||
import com.wisemapping.mail.NotificationService;
|
import com.wisemapping.mail.NotificationService;
|
||||||
|
import com.wisemapping.model.Collaboration;
|
||||||
import com.wisemapping.model.Mindmap;
|
import com.wisemapping.model.Mindmap;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.rest.model.RestLogItem;
|
import com.wisemapping.rest.model.RestLogItem;
|
||||||
@ -31,9 +33,13 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class AccountController extends BaseController {
|
public class AccountController extends BaseController {
|
||||||
@ -100,6 +106,21 @@ public class AccountController extends BaseController {
|
|||||||
userService.updateUser(user);
|
userService.updateUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.DELETE, value = "account", consumes = {"text/plain"})
|
||||||
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
|
public void deleleteUser() 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.deleteUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = "logger/editor", consumes = {"application/xml", "application/json"}, produces = {"application/json", "text/html", "application/xml"})
|
@RequestMapping(method = RequestMethod.POST, value = "logger/editor", consumes = {"application/xml", "application/json"}, produces = {"application/json", "text/html", "application/xml"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void logError(@RequestBody RestLogItem item, @NotNull HttpServletRequest request) {
|
public void logError(@RequestBody RestLogItem item, @NotNull HttpServletRequest request) {
|
||||||
|
@ -117,11 +117,18 @@ public class AdminController extends BaseController {
|
|||||||
|
|
||||||
@RequestMapping(method = RequestMethod.DELETE, value = "admin/users/{id}", consumes = {"text/plain"})
|
@RequestMapping(method = RequestMethod.DELETE, value = "admin/users/{id}", consumes = {"text/plain"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void getUserByEmail(@PathVariable long id) throws WiseMappingException {
|
public void deleteUserByEmail(@PathVariable long id) throws WiseMappingException {
|
||||||
final User user = userService.getUserBy(id);
|
final User user = userService.getUserBy(id);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
throw new IllegalArgumentException("User '" + id + "' could not be found");
|
throw new IllegalArgumentException("User '" + id + "' could not be found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final List<Collaboration> collaborations = mindmapService.findCollaborations(user);
|
||||||
|
for (Collaboration collaboration : collaborations) {
|
||||||
|
final Mindmap mindmap = collaboration.getMindMap();
|
||||||
|
mindmapService.removeMindmap(mindmap,user);
|
||||||
|
}
|
||||||
|
|
||||||
userService.deleteUser(user);
|
userService.deleteUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,11 @@ package com.wisemapping.service;
|
|||||||
import com.wisemapping.dao.UserManager;
|
import com.wisemapping.dao.UserManager;
|
||||||
import com.wisemapping.exceptions.WiseMappingException;
|
import com.wisemapping.exceptions.WiseMappingException;
|
||||||
import com.wisemapping.mail.NotificationService;
|
import com.wisemapping.mail.NotificationService;
|
||||||
import com.wisemapping.model.*;
|
import com.wisemapping.model.AccessAuditory;
|
||||||
|
import com.wisemapping.model.AuthenticationType;
|
||||||
|
import com.wisemapping.model.Collaborator;
|
||||||
|
import com.wisemapping.model.Mindmap;
|
||||||
|
import com.wisemapping.model.User;
|
||||||
import org.apache.velocity.app.VelocityEngine;
|
import org.apache.velocity.app.VelocityEngine;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@ -29,8 +33,11 @@ import org.springframework.context.MessageSource;
|
|||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
import org.springframework.ui.velocity.VelocityEngineUtils;
|
import org.springframework.ui.velocity.VelocityEngineUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.util.Calendar;
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class UserServiceImpl
|
public class UserServiceImpl
|
||||||
implements UserService {
|
implements UserService {
|
||||||
|
@ -88,6 +88,18 @@
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="tab-pane fade" id="deleteAccountPanel">
|
||||||
|
<div id="deleteAccountMsg" class="alert">
|
||||||
|
</div>
|
||||||
|
<form action="#" method="POST" id="deleteAccountForm">
|
||||||
|
<fieldset>
|
||||||
|
<label for="accountMarkedForDelete"><strong><spring:message code="NEW_PASSWORD"/>:</strong></label>
|
||||||
|
<input type="checkbox" name="confirmAccountDelete" id="confirmAccountDelete" required="required"/>
|
||||||
|
<input type="submit" id="deleteAccountBtn" class="btn btn-primary"
|
||||||
|
value="<spring:message code="DELETE__ACCOUNT"/>"/>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -95,6 +107,7 @@
|
|||||||
$('#changePasswordMsg').hide();
|
$('#changePasswordMsg').hide();
|
||||||
$('#changeInfoMsg').hide();
|
$('#changeInfoMsg').hide();
|
||||||
$('#languageMsg').hide();
|
$('#languageMsg').hide();
|
||||||
|
$('#deleteAccountMsg').hide();
|
||||||
|
|
||||||
function postChange(url, postBody, msgContainerId, successMsg) {
|
function postChange(url, postBody, msgContainerId, successMsg) {
|
||||||
// Change success message ...
|
// Change success message ...
|
||||||
@ -144,4 +157,14 @@
|
|||||||
postChange("c/restful/account/locale", locale, 'languageMsg', "<spring:message code="INFO_UPDATE_SUCCESS"/>");
|
postChange("c/restful/account/locale", locale, 'languageMsg', "<spring:message code="INFO_UPDATE_SUCCESS"/>");
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#deleteAccountForm').submit(function (event) {
|
||||||
|
|
||||||
|
var locale = $('#deleteAccountForm option:selected').val();
|
||||||
|
|
||||||
|
postChange("c/restful/account/locale", locale, 'languageMsg', "<spring:message code="INFO_UPDATE_SUCCESS"/>");
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user