mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 22:27:55 +01:00
Remove username attribute
This commit is contained in:
parent
80cafc0c0d
commit
853aa0ad5c
@ -201,16 +201,16 @@ public class MindmapManagerImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeMindmap(MindMap mindMap) {
|
public void removeMindmap(@NotNull final MindMap mindMap) {
|
||||||
getHibernateTemplate().delete(mindMap);
|
getHibernateTemplate().delete(mindMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveHistory(MindMap mindMap) {
|
private void saveHistory(@NotNull final MindMap mindMap) {
|
||||||
final MindMapHistory history = new MindMapHistory();
|
final MindMapHistory history = new MindMapHistory();
|
||||||
|
|
||||||
history.setXml(mindMap.getXml());
|
history.setXml(mindMap.getXml());
|
||||||
history.setCreationTime(Calendar.getInstance());
|
history.setCreationTime(Calendar.getInstance());
|
||||||
history.setCreator(mindMap.getLastModifierUser());
|
history.setEditor(mindMap.getLastEditor());
|
||||||
history.setMindmapId(mindMap.getId());
|
history.setMindmapId(mindMap.getId());
|
||||||
getHibernateTemplate().saveOrUpdate(history);
|
getHibernateTemplate().saveOrUpdate(history);
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,6 @@ public interface UserManager {
|
|||||||
|
|
||||||
public User getUserBy(long id);
|
public User getUserBy(long id);
|
||||||
|
|
||||||
User getUserByUsername(String username);
|
|
||||||
|
|
||||||
void createUser(User user);
|
void createUser(User user);
|
||||||
|
|
||||||
void auditLogin(@NotNull AccessAuditory accessAuditory);
|
void auditLogin(@NotNull AccessAuditory accessAuditory);
|
||||||
|
@ -73,19 +73,6 @@ public class UserManagerImpl
|
|||||||
return getHibernateTemplate().get(User.class, id);
|
return getHibernateTemplate().get(User.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public User getUserByUsername(String username) {
|
|
||||||
final User user;
|
|
||||||
final List users = getHibernateTemplate().find("from com.wisemapping.model.User colaborator where username=?", username);
|
|
||||||
if (users != null && !users.isEmpty()) {
|
|
||||||
assert users.size() == 1 : "More than one user with the same username!";
|
|
||||||
user = (User) users.get(0);
|
|
||||||
} else {
|
|
||||||
user = null;
|
|
||||||
}
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createUser(User user) {
|
public void createUser(User user) {
|
||||||
assert user != null : "Trying to store a null user";
|
assert user != null : "Trying to store a null user";
|
||||||
|
@ -40,7 +40,7 @@ public class MindMap {
|
|||||||
|
|
||||||
private boolean isPublic;
|
private boolean isPublic;
|
||||||
private Calendar lastModificationTime;
|
private Calendar lastModificationTime;
|
||||||
private String lastModifierUser;
|
private User lastEditor;
|
||||||
|
|
||||||
private Set<Collaboration> collaborations = new HashSet<Collaboration>();
|
private Set<Collaboration> collaborations = new HashSet<Collaboration>();
|
||||||
|
|
||||||
@ -144,12 +144,13 @@ public class MindMap {
|
|||||||
this.lastModificationTime = lastModificationTime;
|
this.lastModificationTime = lastModificationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLastModifierUser() {
|
@Nullable
|
||||||
return lastModifierUser;
|
public User getLastEditor() {
|
||||||
|
return lastEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLastModifierUser(String lastModifierUser) {
|
public void setLastEditor(@Nullable User lastEditor) {
|
||||||
this.lastModifierUser = lastModifierUser;
|
this.lastEditor = lastEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
|
@ -18,21 +18,19 @@
|
|||||||
|
|
||||||
package com.wisemapping.model;
|
package com.wisemapping.model;
|
||||||
|
|
||||||
import com.wisemapping.util.ZipUtils;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class MindMapHistory {
|
public class MindMapHistory {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private Calendar creationTime;
|
private Calendar creationTime;
|
||||||
private String creator;
|
private User editor;
|
||||||
private byte[] xml;
|
private byte[] xml;
|
||||||
private int mindmapId;
|
private int mindmapId;
|
||||||
|
|
||||||
public MindMapHistory()
|
public MindMapHistory() {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,12 +58,13 @@ public class MindMapHistory {
|
|||||||
this.creationTime = creationTime;
|
this.creationTime = creationTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCreator() {
|
@Nullable
|
||||||
return creator;
|
public User getEditor() {
|
||||||
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreator(String creator) {
|
public void setEditor(@Nullable User editor) {
|
||||||
this.creator = creator;
|
this.editor = editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getXml() {
|
public byte[] getXml() {
|
||||||
|
@ -32,7 +32,6 @@ public class User
|
|||||||
private String password;
|
private String password;
|
||||||
private long activationCode;
|
private long activationCode;
|
||||||
private Calendar activationDate;
|
private Calendar activationDate;
|
||||||
private String username;
|
|
||||||
private Set<String> tags = new HashSet<String>();
|
private Set<String> tags = new HashSet<String>();
|
||||||
private boolean allowSendEmail = false;
|
private boolean allowSendEmail = false;
|
||||||
private String locale;
|
private String locale;
|
||||||
@ -118,9 +117,7 @@ public class User
|
|||||||
final String email = getEmail();
|
final String email = getEmail();
|
||||||
if (email != null ? !email.equals(user.getEmail()) : user.getEmail() != null) return false;
|
if (email != null ? !email.equals(user.getEmail()) : user.getEmail() != null) return false;
|
||||||
if (firstname != null ? !firstname.equals(user.firstname) : user.firstname != null) return false;
|
if (firstname != null ? !firstname.equals(user.firstname) : user.firstname != null) return false;
|
||||||
if (lastname != null ? !lastname.equals(user.lastname) : user.lastname != null) return false;
|
return !(lastname != null ? !lastname.equals(user.lastname) : user.lastname != null);
|
||||||
return !(username != null ? !username.equals(user.username) : user.username != null);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -133,14 +130,6 @@ public class User
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsername(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public String getLocale() {
|
public String getLocale() {
|
||||||
return locale;
|
return locale;
|
||||||
|
@ -108,7 +108,6 @@ public class UsersController {
|
|||||||
|
|
||||||
// trim() the email email in order to remove spaces ...
|
// trim() the email email in order to remove spaces ...
|
||||||
user.setEmail(userBean.getEmail().trim());
|
user.setEmail(userBean.getEmail().trim());
|
||||||
user.setUsername(userBean.getUsername());
|
|
||||||
user.setFirstname(userBean.getFirstname());
|
user.setFirstname(userBean.getFirstname());
|
||||||
user.setLastname(userBean.getLastname());
|
user.setLastname(userBean.getLastname());
|
||||||
user.setPassword(userBean.getPassword());
|
user.setPassword(userBean.getPassword());
|
||||||
|
@ -58,16 +58,6 @@ public class AdminController extends BaseController {
|
|||||||
return new ModelAndView("userView", "user", new RestUser(user));
|
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"})
|
@RequestMapping(method = RequestMethod.POST, value = "admin/users", consumes = {"application/xml", "application/json"}, produces = {"application/json", "text/html", "application/xml"})
|
||||||
@ResponseStatus(value = HttpStatus.CREATED)
|
@ResponseStatus(value = HttpStatus.CREATED)
|
||||||
public void createUser(@RequestBody RestUser user, HttpServletResponse response) throws IOException, WiseMappingException {
|
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.");
|
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 ...
|
// Run some other validations ...
|
||||||
final User delegated = user.getDelegated();
|
final User delegated = user.getDelegated();
|
||||||
final String lastname = delegated.getLastname();
|
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 {
|
private void saveMindmap(boolean minor, @NotNull final MindMap mindMap, @NotNull final User user) throws WiseMappingException {
|
||||||
final Calendar now = Calendar.getInstance();
|
final Calendar now = Calendar.getInstance();
|
||||||
mindMap.setLastModificationTime(now);
|
mindMap.setLastModificationTime(now);
|
||||||
mindMap.setLastModifierUser(user.getUsername());
|
mindMap.setLastEditor(user);
|
||||||
mindmapService.updateMindmap(mindMap, !minor);
|
mindmapService.updateMindmap(mindMap, !minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,8 +81,8 @@ public class RestMindmap {
|
|||||||
return mindmap.getCreator().getEmail();
|
return mindmap.getCreator().getEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLastModifierUser() {
|
public Collaborator getLastModifierUser() {
|
||||||
return mindmap.getLastModifierUser();
|
return mindmap.getLastEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLastModificationTime() {
|
public String getLastModificationTime() {
|
||||||
|
@ -44,7 +44,7 @@ public class RestMindmapHistory {
|
|||||||
public RestMindmapHistory(@NotNull MindMapHistory history) {
|
public RestMindmapHistory(@NotNull MindMapHistory history) {
|
||||||
this.id = history.getId();
|
this.id = history.getId();
|
||||||
this.creation = history.getCreationTime();
|
this.creation = history.getCreationTime();
|
||||||
this.creator = history.getCreator();
|
this.creator = history.getEditor().getFullName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCreationTime() {
|
public String getCreationTime() {
|
||||||
|
@ -88,7 +88,8 @@ public class RestMindmapInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getLastModifierUser() {
|
public String getLastModifierUser() {
|
||||||
return mindmap.getLastModifierUser();
|
final User user = mindmap.getLastEditor();
|
||||||
|
return user != null ? user.getFullName() : "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLastModificationTime() {
|
public String getLastModificationTime() {
|
||||||
|
@ -66,14 +66,6 @@ public class RestUser {
|
|||||||
// return user.isActive();
|
// return user.isActive();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public String getUsername() {
|
|
||||||
return user.getUsername();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsername(String username) {
|
|
||||||
user.setUsername(username);
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return user.getId();
|
return user.getId();
|
||||||
}
|
}
|
||||||
|
@ -137,8 +137,7 @@ public class MindmapServiceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Calendar creationTime = Calendar.getInstance();
|
final Calendar creationTime = Calendar.getInstance();
|
||||||
final String username = user.getUsername();
|
map.setLastEditor(user);
|
||||||
map.setLastModifierUser(username);
|
|
||||||
map.setCreationTime(creationTime);
|
map.setCreationTime(creationTime);
|
||||||
map.setLastModificationTime(creationTime);
|
map.setLastModificationTime(creationTime);
|
||||||
map.setCreator(user);
|
map.setCreator(user);
|
||||||
|
@ -34,8 +34,6 @@ public interface UserService {
|
|||||||
|
|
||||||
public User getUserBy(long id);
|
public User getUserBy(long id);
|
||||||
|
|
||||||
public User getUserByUsername(String username);
|
|
||||||
|
|
||||||
public void updateUser(User user);
|
public void updateUser(User user);
|
||||||
|
|
||||||
public void resetPassword(@NotNull String email) throws InvalidUserEmailException;
|
public void resetPassword(@NotNull String email) throws InvalidUserEmailException;
|
||||||
|
@ -176,11 +176,6 @@ public class UserServiceImpl
|
|||||||
return userManager.getUserBy(email);
|
return userManager.getUserBy(email);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public User getUserByUsername(String username) {
|
|
||||||
return userManager.getUserByUsername(username);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User getUserBy(long id) {
|
public User getUserBy(long id) {
|
||||||
return userManager.getUserBy(id);
|
return userManager.getUserBy(id);
|
||||||
|
@ -56,14 +56,6 @@ public class UserValidator
|
|||||||
Utils.validateEmailAddress(email, errors);
|
Utils.validateEmailAddress(email, errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate username ...
|
|
||||||
final String username = user.getUsername();
|
|
||||||
if (username != null && userService.getUserByUsername(username) != null) {
|
|
||||||
errors.rejectValue("username", Messages.USERNAME_ALREADY_EXIST);
|
|
||||||
} else {
|
|
||||||
ValidationUtils.rejectIfEmpty(errors, "username", Messages.FIELD_REQUIRED);
|
|
||||||
}
|
|
||||||
|
|
||||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "firstname", Messages.FIELD_REQUIRED);
|
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "firstname", Messages.FIELD_REQUIRED);
|
||||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "lastname", Messages.FIELD_REQUIRED);
|
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "lastname", Messages.FIELD_REQUIRED);
|
||||||
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", Messages.FIELD_REQUIRED);
|
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", Messages.FIELD_REQUIRED);
|
||||||
@ -78,11 +70,6 @@ public class UserValidator
|
|||||||
"The lastname must have less than " + Constants.MAX_USER_LASTNAME_LENGTH + " characters.",
|
"The lastname must have less than " + Constants.MAX_USER_LASTNAME_LENGTH + " characters.",
|
||||||
user.getLastname(),
|
user.getLastname(),
|
||||||
Constants.MAX_USER_LASTNAME_LENGTH);
|
Constants.MAX_USER_LASTNAME_LENGTH);
|
||||||
ValidatorUtils.rejectIfExceeded(errors,
|
|
||||||
"username",
|
|
||||||
"The username must have less than " + Constants.MAX_USER_USERNAME_LENGTH + " characters.",
|
|
||||||
username,
|
|
||||||
Constants.MAX_USER_USERNAME_LENGTH);
|
|
||||||
ValidatorUtils.rejectIfExceeded(errors,
|
ValidatorUtils.rejectIfExceeded(errors,
|
||||||
"password",
|
"password",
|
||||||
"The password must have less than " + Constants.MAX_USER_PASSWORD_LENGTH + " characters.",
|
"The password must have less than " + Constants.MAX_USER_PASSWORD_LENGTH + " characters.",
|
||||||
|
@ -22,48 +22,40 @@ import com.wisemapping.model.CollaborationRole;
|
|||||||
import com.wisemapping.model.Collaborator;
|
import com.wisemapping.model.Collaborator;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
|
|
||||||
public class CollaboratorBean
|
public class CollaboratorBean {
|
||||||
{
|
|
||||||
private CollaborationRole collaborationRole;
|
private CollaborationRole collaborationRole;
|
||||||
private boolean isUser;
|
private boolean isUser;
|
||||||
private Collaborator collaborator;
|
private Collaborator collaborator;
|
||||||
|
|
||||||
public CollaboratorBean(Collaborator collaborator, CollaborationRole role)
|
public CollaboratorBean(Collaborator collaborator, CollaborationRole role) {
|
||||||
{
|
|
||||||
this.collaborator = collaborator;
|
this.collaborator = collaborator;
|
||||||
this.collaborationRole = role;
|
this.collaborationRole = role;
|
||||||
this.isUser = false;
|
this.isUser = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CollaboratorBean(User user, CollaborationRole role)
|
public CollaboratorBean(User user, CollaborationRole role) {
|
||||||
{
|
|
||||||
this.collaborator = user;
|
this.collaborator = user;
|
||||||
this.collaborationRole = role;
|
this.collaborationRole = role;
|
||||||
this.isUser = true;
|
this.isUser = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUser()
|
public boolean isUser() {
|
||||||
{
|
|
||||||
return isUser;
|
return isUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRole()
|
public String getRole() {
|
||||||
{
|
|
||||||
return collaborationRole.name();
|
return collaborationRole.name();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUsername()
|
public String getUsername() {
|
||||||
{
|
return isUser ? ((User) collaborator).getFullName() : collaborator.getEmail();
|
||||||
return isUser ? ((User) collaborator).getUsername() : collaborator.getEmail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEmail()
|
public String getEmail() {
|
||||||
{
|
|
||||||
return collaborator.getEmail();
|
return collaborator.getEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getId()
|
public long getId() {
|
||||||
{
|
|
||||||
return collaborator.getId();
|
return collaborator.getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,8 @@ public class MindMapBean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getLastEditor() {
|
public String getLastEditor() {
|
||||||
return mindmap.getLastModifierUser();
|
final User lastEditor = mindmap.getLastEditor();
|
||||||
|
return lastEditor != null ? lastEditor.getFullName() : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLastEditTime() {
|
public String getLastEditTime() {
|
||||||
|
@ -21,13 +21,12 @@
|
|||||||
|
|
||||||
<joined-subclass name="com.wisemapping.model.User" table="USER">
|
<joined-subclass name="com.wisemapping.model.User" table="USER">
|
||||||
<key column="COLABORATOR_ID"/>
|
<key column="COLABORATOR_ID"/>
|
||||||
<property name="username" not-null="true"/>
|
|
||||||
<property name="firstname"/>
|
<property name="firstname"/>
|
||||||
<property name="lastname"/>
|
<property name="lastname"/>
|
||||||
<property name="password"/>
|
<property name="password"/>
|
||||||
<property name="activationDate" column="activation_date"/>
|
<property name="activationDate" column="activation_date"/>
|
||||||
<property name="activationCode"/>
|
<property name="activationCode" column="activation_code"/>
|
||||||
<property name="allowSendEmail"/>
|
<property name="allowSendEmail" column="allow_send_email"/>
|
||||||
<property name="locale"/>
|
<property name="locale"/>
|
||||||
<set name="tags" table="TAG">
|
<set name="tags" table="TAG">
|
||||||
<key column="user_id"/>
|
<key column="user_id"/>
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
<property name="public"/>
|
<property name="public"/>
|
||||||
<property name="description"/>
|
<property name="description"/>
|
||||||
<property name="zippedXml" column="XML"/>
|
<property name="zippedXml" column="XML"/>
|
||||||
<property name="lastModifierUser" column="last_editor"/>
|
|
||||||
<property name="lastModificationTime" column="edition_date"/>
|
<property name="lastModificationTime" column="edition_date"/>
|
||||||
<property name="creationTime" column="creation_date"/>
|
<property name="creationTime" column="creation_date"/>
|
||||||
<property name="tags" column="tags"/>
|
<property name="tags" column="tags"/>
|
||||||
<many-to-one name="creator" column="creator_id" unique="true" not-null="true"/>
|
<many-to-one name="creator" column="creator_id" unique="true" not-null="false" lazy="proxy"/>
|
||||||
|
<many-to-one name="lastEditor" column="last_editor_id" unique="false" not-null="true" lazy="proxy"/>
|
||||||
|
|
||||||
<set name="collaborations"
|
<set name="collaborations"
|
||||||
cascade="all,delete-orphan"
|
cascade="all,delete-orphan"
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<property name="mindmapId" column="mindmap_id"/>
|
<property name="mindmapId" column="mindmap_id"/>
|
||||||
<property name="xml" column="XML"/>
|
<property name="xml" column="XML"/>
|
||||||
<property name="creationTime" column="creation_date"/>
|
<property name="creationTime" column="creation_date"/>
|
||||||
<property name="creator" column="creator_user"/>
|
<many-to-one name="editor" column="editor_id" unique="false" not-null="false" lazy="proxy"/>
|
||||||
</class>
|
</class>
|
||||||
|
|
||||||
</hibernate-mapping>
|
</hibernate-mapping>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<ul class="nav nav-tabs">
|
<ul class="nav nav-tabs">
|
||||||
<li class="active"><a href="#general" data-toggle="pill">General</a></li>
|
<li class="active"><a href="#general" data-toggle="pill"><spring:message code="DESCRIPTION"/></a></li>
|
||||||
<li><a href="#collaborators" data-toggle="pill"><spring:message code="SHARED"/></a></li>
|
<li><a href="#collaborators" data-toggle="pill"><spring:message code="SHARED"/></a></li>
|
||||||
<li><a href="#publish" data-toggle="pill"><spring:message code="PUBLIC"/></a></li>
|
<li><a href="#publish" data-toggle="pill"><spring:message code="PUBLIC"/></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -14,7 +14,7 @@
|
|||||||
<ul class="unstyled">
|
<ul class="unstyled">
|
||||||
<li><strong><spring:message code="NAME"/>:</strong> ${mindmap.title}</li>
|
<li><strong><spring:message code="NAME"/>:</strong> ${mindmap.title}</li>
|
||||||
<li><strong><spring:message code="DESCRIPTION"/>:</strong> ${mindmap.description}</li>
|
<li><strong><spring:message code="DESCRIPTION"/>:</strong> ${mindmap.description}</li>
|
||||||
<li><strong><spring:message code="CREATOR"/>:</strong> ${mindmap.creator.username}</li>
|
<li><strong><spring:message code="CREATOR"/>:</strong> ${mindmap.creator.fullName}</li>
|
||||||
<li><strong><spring:message code="CREATION_TIME"/>:</strong> ${mindmap.creationTime}</li>
|
<li><strong><spring:message code="CREATION_TIME"/>:</strong> ${mindmap.creationTime}</li>
|
||||||
<li><strong><spring:message code="LAST_UPDATE"/>:</strong> ${mindmap.lastEditTime}</li>
|
<li><strong><spring:message code="LAST_UPDATE"/>:</strong> ${mindmap.lastEditTime}</li>
|
||||||
<li><strong><spring:message code="LAST_UPDATE_BY"/>:</strong> ${mindmap.lastEditor}</li>
|
<li><strong><spring:message code="LAST_UPDATE_BY"/>:</strong> ${mindmap.lastEditor}</li>
|
||||||
|
@ -13,11 +13,6 @@
|
|||||||
<form:input path="email" id="email" type="email" required="required"/>
|
<form:input path="email" id="email" type="email" required="required"/>
|
||||||
<form:errors path="email" cssClass="errorMsg"/>
|
<form:errors path="email" cssClass="errorMsg"/>
|
||||||
|
|
||||||
<label for="username"> <spring:message code="USERNAME"/></label>
|
|
||||||
<form:input path="username" id="username" required="required"/>
|
|
||||||
<form:errors path="username" cssClass="errorMsg"/>
|
|
||||||
|
|
||||||
|
|
||||||
<label for="firstname"><spring:message code="FIRSTNAME"/></label>
|
<label for="firstname"><spring:message code="FIRSTNAME"/></label>
|
||||||
<form:input path="firstname" id="firstname" required="required"/>
|
<form:input path="firstname" id="firstname" required="required"/>
|
||||||
<form:errors path="firstname" cssClass="errorMsg"/>
|
<form:errors path="firstname" cssClass="errorMsg"/>
|
||||||
|
@ -75,25 +75,6 @@ public class RestAdminITCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test(dataProvider = "ContentType-Provider-Function")
|
|
||||||
public void findUserByUsername(final @NotNull MediaType mediaType) { // Configure media types ...
|
|
||||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
|
||||||
final RestTemplate templateRest = createTemplate();
|
|
||||||
|
|
||||||
final RestUser restUser = createDummyUser();
|
|
||||||
|
|
||||||
// User has been created ...
|
|
||||||
createUser(requestHeaders, templateRest, restUser);
|
|
||||||
|
|
||||||
// Check that the user has been created ...
|
|
||||||
HttpEntity<RestUser> findUserEntity = new HttpEntity<RestUser>(requestHeaders);
|
|
||||||
final ResponseEntity<RestUser> responseEntity = templateRest.exchange(BASE_REST_URL + "/admin/users/username/" + restUser.getUsername(), HttpMethod.GET, findUserEntity, RestUser.class);
|
|
||||||
|
|
||||||
assertEquals(responseEntity.getBody().getUsername(), restUser.getUsername());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public String createNewUser(final @NotNull MediaType mediaType) {
|
public String createNewUser(final @NotNull MediaType mediaType) {
|
||||||
|
|
||||||
// Configure media types ...
|
// Configure media types ...
|
||||||
@ -172,7 +153,6 @@ public class RestAdminITCase {
|
|||||||
final String username = "foo-to-delete" + System.nanoTime();
|
final String username = "foo-to-delete" + System.nanoTime();
|
||||||
final String email = username + "@example.org";
|
final String email = username + "@example.org";
|
||||||
restUser.setEmail(email);
|
restUser.setEmail(email);
|
||||||
restUser.setUsername(username);
|
|
||||||
restUser.setFirstname("foo first name");
|
restUser.setFirstname("foo first name");
|
||||||
restUser.setLastname("foo last name");
|
restUser.setLastname("foo last name");
|
||||||
restUser.setPassword("admin");
|
restUser.setPassword("admin");
|
||||||
|
@ -6,13 +6,12 @@ creation_date date);
|
|||||||
CREATE TABLE USER (
|
CREATE TABLE USER (
|
||||||
id INTEGER NOT NULL IDENTITY,
|
id INTEGER NOT NULL IDENTITY,
|
||||||
colaborator_id INTEGER NOT NULL,
|
colaborator_id INTEGER NOT NULL,
|
||||||
username varchar(255) NOT NULL,
|
|
||||||
firstname varchar(255) NOT NULL,
|
firstname varchar(255) NOT NULL,
|
||||||
lastname varchar(255) NOT NULL,
|
lastname varchar(255) NOT NULL,
|
||||||
password varchar(255) NOT NULL,
|
password varchar(255) NOT NULL,
|
||||||
activationCode BIGINT NOT NULL,
|
activation_code BIGINT NOT NULL,
|
||||||
activation_date DATE,
|
activation_date DATE,
|
||||||
allowSendEmail CHAR(1) NOT NULL,
|
allow_send_email CHAR(1) NOT NULL,
|
||||||
locale varchar(5),
|
locale varchar(5),
|
||||||
FOREIGN KEY(colaborator_id) REFERENCES COLLABORATOR(id)
|
FOREIGN KEY(colaborator_id) REFERENCES COLLABORATOR(id)
|
||||||
);
|
);
|
||||||
@ -27,7 +26,7 @@ creation_date DATETIME,
|
|||||||
edition_date DATETIME,
|
edition_date DATETIME,
|
||||||
creator_id INTEGER NOT NULL,
|
creator_id INTEGER NOT NULL,
|
||||||
tags varchar(1014) ,
|
tags varchar(1014) ,
|
||||||
last_editor varchar(255) ,
|
last_editor_id INTEGER NOT NULL
|
||||||
--FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id)
|
--FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -36,7 +35,7 @@ CREATE TABLE MINDMAP_HISTORY
|
|||||||
xml LONGVARBINARY NOT NULL,
|
xml LONGVARBINARY NOT NULL,
|
||||||
mindmap_id INTEGER NOT NULL,
|
mindmap_id INTEGER NOT NULL,
|
||||||
creation_date DATETIME,
|
creation_date DATETIME,
|
||||||
creator_user varchar(255));
|
editor_id INTEGER NOT NULL);
|
||||||
|
|
||||||
CREATE TABLE COLLABORATION_PROPERTIES
|
CREATE TABLE COLLABORATION_PROPERTIES
|
||||||
(id INTEGER NOT NULL IDENTITY,
|
(id INTEGER NOT NULL IDENTITY,
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
INSERT INTO COLLABORATOR(id,email,creation_date) values (1,'test@wisemapping.org',CURDATE());
|
INSERT INTO COLLABORATOR(id,email,creation_date) values (1,'test@wisemapping.org',CURDATE());
|
||||||
INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail)
|
INSERT INTO USER (colaborator_id,firstname, lastname, password, activation_code,activation_date,allow_send_email)
|
||||||
values(1,'wise-test','Test','User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',1237,CURDATE(),1);
|
values(1,'Test','User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',1237,CURDATE(),1);
|
||||||
|
|
||||||
INSERT INTO COLLABORATOR(id,email,creation_date) values (2,'admin@wisemapping.org',CURDATE());
|
INSERT INTO COLLABORATOR(id,email,creation_date) values (2,'admin@wisemapping.org',CURDATE());
|
||||||
INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail)
|
INSERT INTO USER (colaborator_id,firstname, lastname, password, activation_code,activation_date,allow_send_email)
|
||||||
values(2,'wise-admin','Admin','User', 'admin',1237,CURDATE(),1);
|
values(2,'Admin','User', 'admin',1237,CURDATE(),1);
|
||||||
|
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@ -7,7 +7,6 @@ creation_date date
|
|||||||
CREATE TABLE USER (
|
CREATE TABLE USER (
|
||||||
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
colaborator_id INTEGER NOT NULL,
|
colaborator_id INTEGER NOT NULL,
|
||||||
username varchar(255) CHARACTER SET utf8 NOT NULL,
|
|
||||||
firstname varchar(255) CHARACTER SET utf8 NOT NULL,
|
firstname varchar(255) CHARACTER SET utf8 NOT NULL,
|
||||||
lastname varchar(255) CHARACTER SET utf8 NOT NULL,
|
lastname varchar(255) CHARACTER SET utf8 NOT NULL,
|
||||||
password varchar(255) CHARACTER SET utf8 NOT NULL,
|
password varchar(255) CHARACTER SET utf8 NOT NULL,
|
||||||
@ -28,7 +27,7 @@ creation_date datetime,
|
|||||||
edition_date datetime,
|
edition_date datetime,
|
||||||
creator_id INTEGER not null,
|
creator_id INTEGER not null,
|
||||||
tags varchar(1014) CHARACTER SET utf8 ,
|
tags varchar(1014) CHARACTER SET utf8 ,
|
||||||
last_editor varchar(255) CHARACTER SET utf8 ,
|
last_editor_id INTEGER NOT NULL,
|
||||||
FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id) ON DELETE CASCADE ON UPDATE NO ACTION
|
FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||||
) CHARACTER SET utf8 ;
|
) CHARACTER SET utf8 ;
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ CREATE TABLE MINDMAP_HISTORY
|
|||||||
xml blob NOT NULL,
|
xml blob NOT NULL,
|
||||||
mindmap_id INTEGER NOT NULL,
|
mindmap_id INTEGER NOT NULL,
|
||||||
creation_date datetime,
|
creation_date datetime,
|
||||||
creator_user varchar(255) CHARACTER SET utf8
|
editor_id INTEGER NOT NULL
|
||||||
) CHARACTER SET utf8 ;
|
) CHARACTER SET utf8 ;
|
||||||
|
|
||||||
CREATE TABLE COLLABORATION_PROPERTIES(
|
CREATE TABLE COLLABORATION_PROPERTIES(
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
INSERT INTO COLLABORATOR(id,email,creation_date) values (1,'test@wisemapping.org',CURRENT_DATE());
|
INSERT INTO COLLABORATOR(id,email,creation_date) values (1,'test@wisemapping.org',CURRENT_DATE());
|
||||||
INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail)
|
INSERT INTO USER (colaborator_id,firstname, lastname, password, activation_code,activation_date,allow_send_email)
|
||||||
values(1,'wise-test','Test','User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',1237,CURRENT_DATE(),1);
|
values(1,'Test','User', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',1237,CURRENT_DATE(),1);
|
||||||
|
|
||||||
INSERT INTO COLLABORATOR(id,email,creation_date) values (2,'admin@wisemapping.org',CURRENT_DATE());
|
INSERT INTO COLLABORATOR(id,email,creation_date) values (2,'admin@wisemapping.org',CURRENT_DATE());
|
||||||
INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail)
|
INSERT INTO USER (colaborator_id,firstname, lastname, password, activation_code,activation_date,allow_send_email)
|
||||||
values(2,'wise-admin','Admin','User', 'admin',1237,CURRENT_DATE(),1);
|
values(2,'Admin','User', 'admin',1237,CURRENT_DATE(),1);
|
||||||
|
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
@ -30,9 +30,15 @@ ALTER TABLE ACCESS_AUDITORY
|
|||||||
ON UPDATE NO ACTION
|
ON UPDATE NO ACTION
|
||||||
, ADD INDEX `user_id` () ;
|
, ADD INDEX `user_id` () ;
|
||||||
|
|
||||||
|
ALTER TABLE `wisemapping`.`mindmap_history` DROP COLUMN `creator_user` , ADD COLUMN `editor_id` INT(11) NULL DEFAULT NULL AFTER `creation_date`;
|
||||||
|
|
||||||
ALTER TABLE `wisemapping`.`user` ADD COLUMN `locale` VARCHAR(5) NULL AFTER `allowSendEmail` ;
|
ALTER TABLE `wisemapping`.`user` ADD COLUMN `locale` VARCHAR(5) NULL AFTER `allowSendEmail` ;
|
||||||
|
|
||||||
|
ALTER TABLE `wisemapping`.`mindmap` DROP COLUMN `last_editor` , ADD COLUMN `last_editor_id` INT(11) NULL DEFAULT NULL AFTER `tags` ;
|
||||||
|
|
||||||
|
ALTER TABLE `wisemapping2`.`user` DROP COLUMN `username` , CHANGE COLUMN `activationCode` `activation_code` BIGINT(20) NOT NULL , CHANGE COLUMN `allowSendEmail` `allow_send_email` CHAR(1) NOT NULL DEFAULT '0' ;
|
||||||
|
|
||||||
|
|
||||||
# INSERT INTO `wisemapping`.`collaborator` (`id`, `email`, `creation_date`) VALUES (8081, 'fake@wisemapping.com', '2007-10-09');
|
# INSERT INTO `wisemapping`.`collaborator` (`id`, `email`, `creation_date`) VALUES (8081, 'fake@wisemapping.com', '2007-10-09');
|
||||||
# DELETE FROM `wisemapping`.`USER` where activation_date is null;
|
# DELETE FROM `wisemapping`.`USER` where activation_date is null;
|
||||||
# DROP TABLE FEEDBACK;
|
# DROP TABLE FEEDBACK;
|
||||||
|
Loading…
Reference in New Issue
Block a user