Improve delete message.
Add unit test.
This commit is contained in:
@@ -45,6 +45,6 @@ public interface UserManager {
|
||||
|
||||
public User createUser(User user, Collaborator col);
|
||||
|
||||
public void deleteUser(User user);
|
||||
public void removeUser(@NotNull User user);
|
||||
|
||||
}
|
||||
|
@@ -110,9 +110,8 @@ public class UserManagerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUser(@NotNull final User user) {
|
||||
public void removeUser(@NotNull final User user) {
|
||||
getHibernateTemplate().delete(user);
|
||||
getHibernateTemplate().flush();
|
||||
}
|
||||
|
||||
public void auditLogin(@NotNull AccessAuditory accessAuditory) {
|
||||
|
@@ -79,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);
|
||||
}
|
||||
@@ -91,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);
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public class AccountController extends BaseController {
|
||||
userService.updateUser(user);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "account", consumes = {"text/plain"})
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "account")
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void deleleteUser() throws WiseMappingException
|
||||
|
||||
@@ -120,7 +120,7 @@ public class AccountController extends BaseController {
|
||||
final Mindmap mindmap = collaboration.getMindMap();
|
||||
mindmapService.removeMindmap(mindmap,user);
|
||||
}
|
||||
userService.deleteUser(user);
|
||||
userService.removeUser(user);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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;
|
||||
@@ -146,7 +145,7 @@ public class AdminController extends BaseController {
|
||||
mindmapService.removeMindmap(mindmap,user);
|
||||
}
|
||||
|
||||
userService.deleteUser(user);
|
||||
userService.removeUser(user);
|
||||
}
|
||||
|
||||
@ApiOperation("Note: Administration permissions required.")
|
||||
|
@@ -21,12 +21,9 @@ package com.wisemapping.security;
|
||||
import com.wisemapping.model.User;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
final public class Utils {
|
||||
private Utils() {
|
||||
}
|
||||
@@ -37,7 +34,7 @@ final public class Utils {
|
||||
return getUser(false);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
public static User getUser(boolean forceCheck) {
|
||||
User result = null;
|
||||
final Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
||||
|
@@ -46,8 +46,6 @@ public interface MindmapService {
|
||||
|
||||
void removeCollaboration(@NotNull Mindmap mindmap, @NotNull Collaboration collaboration) throws CollaborationException;
|
||||
|
||||
void addTags(@NotNull Mindmap mindmap, String tags);
|
||||
|
||||
void removeMindmap(@NotNull final Mindmap mindmap, @NotNull final User user) throws WiseMappingException;
|
||||
|
||||
List<Mindmap> search(MindMapCriteria criteria);
|
||||
|
@@ -231,28 +231,6 @@ public class MindmapServiceImpl
|
||||
return collaborator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTags(@NotNull Mindmap mindmap, String tags) {
|
||||
mindmap.setTags(tags);
|
||||
mindmapManager.updateMindmap(mindmap, false);
|
||||
if (tags != null && tags.length() > 0) {
|
||||
final String tag[] = tags.split(TAG_SEPARATOR);
|
||||
final User user = mindmap.getCreator();
|
||||
// Add new Tags to User
|
||||
boolean updateUser = false;
|
||||
for (String userTag : tag) {
|
||||
if (!user.getTags().contains(userTag)) {
|
||||
user.getTags().add(userTag);
|
||||
updateUser = true;
|
||||
}
|
||||
}
|
||||
if (updateUser) {
|
||||
//update user
|
||||
userService.updateUser(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<MindMapHistory> findMindmapHistory(int mindmapId) {
|
||||
|
@@ -38,7 +38,7 @@ public interface UserService {
|
||||
|
||||
public void resetPassword(@NotNull String email) throws InvalidUserEmailException, InvalidAuthSchemaException;
|
||||
|
||||
public void deleteUser(@NotNull User user);
|
||||
public void removeUser(@NotNull User user);
|
||||
|
||||
public void auditLogin(@NotNull User user);
|
||||
|
||||
|
@@ -102,8 +102,10 @@ public class UserServiceImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUser(@NotNull User user) {
|
||||
userManager.deleteUser(user);
|
||||
public void removeUser(@NotNull User user) {
|
||||
// Force object reload before removing....
|
||||
final User userBy = userManager.getUserBy(user.getEmail());
|
||||
userManager.removeUser(userBy);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -15,7 +15,7 @@ LOGOUT=Logout
|
||||
PASSWORD=Password
|
||||
NEW_PASSWORD=New password
|
||||
CONFIRM_NEW_PASSWORD=Confirm new password
|
||||
DELETE__ACCOUNT=Delete account
|
||||
DELETE__ACCOUNT=Delete My Account
|
||||
MY_WISEMAPS=My Wisemaps
|
||||
RETYPE_PASSWORD=Retype Password
|
||||
REGISTER=Register
|
||||
@@ -32,7 +32,7 @@ YOUR_ROLE=Your Role
|
||||
FORGOT_PASSWORD=Forgot Password ?
|
||||
CHANGE_PASSWORD=Change Password
|
||||
CHANGE_LANGUAGE=Change Language
|
||||
WARNING_DELETE_USER=Warning! This action cannot be undone.
|
||||
WARNING_DELETE_USER=If you do not think you will use WiseMapping again and would like your account deleted, we can take care of this for you. Keep in mind that you will not be able retrieve any mindmap you have added. <br/><br/> If you would still like your account deleted, click "Delete My Account".
|
||||
FAQ=Frequent Asked Questions
|
||||
SHORT_FAQ=FAQ
|
||||
LOGIN=Login
|
||||
|
Reference in New Issue
Block a user