mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 22:27:55 +01:00
Audith login operations.
This commit is contained in:
parent
c8837baadd
commit
3349f2e567
@ -20,7 +20,8 @@ package com.wisemapping.dao;
|
|||||||
|
|
||||||
import com.wisemapping.model.Collaborator;
|
import com.wisemapping.model.Collaborator;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.model.UserLogin;
|
import com.wisemapping.model.AccessAuditory;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ public interface UserManager {
|
|||||||
|
|
||||||
void createUser(User user);
|
void createUser(User user);
|
||||||
|
|
||||||
void auditLogin(UserLogin userLogin);
|
void auditLogin(@NotNull AccessAuditory accessAuditory);
|
||||||
|
|
||||||
void updateUser(User user);
|
void updateUser(User user);
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ package com.wisemapping.dao;
|
|||||||
import com.wisemapping.model.Collaboration;
|
import com.wisemapping.model.Collaboration;
|
||||||
import com.wisemapping.model.Collaborator;
|
import com.wisemapping.model.Collaborator;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.model.UserLogin;
|
import com.wisemapping.model.AccessAuditory;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||||
import org.springframework.security.authentication.encoding.PasswordEncoder;
|
import org.springframework.security.authentication.encoding.PasswordEncoder;
|
||||||
@ -121,9 +121,9 @@ public class UserManagerImpl
|
|||||||
getHibernateTemplate().flush();
|
getHibernateTemplate().flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void auditLogin(UserLogin userLogin) {
|
public void auditLogin(@NotNull AccessAuditory accessAuditory) {
|
||||||
assert userLogin != null : "userLogin is null";
|
assert accessAuditory != null : "accessAuditory is null";
|
||||||
getHibernateTemplate().save(userLogin);
|
getHibernateTemplate().save(accessAuditory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateUser(@NotNull User user) {
|
public void updateUser(@NotNull User user) {
|
||||||
|
59
wise-webapp/src/main/java/com/wisemapping/model/AccessAuditory.java
Executable file
59
wise-webapp/src/main/java/com/wisemapping/model/AccessAuditory.java
Executable file
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright [2011] [wisemapping]
|
||||||
|
*
|
||||||
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the license at
|
||||||
|
*
|
||||||
|
* http://www.wisemapping.org/license
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.wisemapping.model;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
public class AccessAuditory
|
||||||
|
implements Serializable {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private Calendar loginDate = null;
|
||||||
|
private User user = null;
|
||||||
|
|
||||||
|
public AccessAuditory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLoginDate(@NotNull Calendar loginDate) {
|
||||||
|
this.loginDate = loginDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Calendar getLoginDate() {
|
||||||
|
return loginDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(@NotNull User user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getUser() {
|
||||||
|
return this.user;
|
||||||
|
}
|
||||||
|
}
|
@ -1,83 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright [2011] [wisemapping]
|
|
||||||
*
|
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the license at
|
|
||||||
*
|
|
||||||
* http://www.wisemapping.org/license
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.wisemapping.model;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
public class UserLogin
|
|
||||||
implements Serializable
|
|
||||||
{
|
|
||||||
|
|
||||||
private int id;
|
|
||||||
private Calendar loginDate = null;
|
|
||||||
private String email = null;
|
|
||||||
|
|
||||||
public UserLogin()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLoginDate(Calendar loginDate)
|
|
||||||
{
|
|
||||||
this.loginDate = loginDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Calendar getLoginDate()
|
|
||||||
{
|
|
||||||
return loginDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEmail(String email)
|
|
||||||
{
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEmail()
|
|
||||||
{
|
|
||||||
return email;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) return true;
|
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
|
||||||
|
|
||||||
final UserLogin userLogin = (UserLogin) o;
|
|
||||||
|
|
||||||
if (loginDate.equals(userLogin.loginDate)) return false;
|
|
||||||
if (email.equals(userLogin.email)) return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int hashCode() {
|
|
||||||
int result;
|
|
||||||
result = (loginDate!= null ? loginDate.hashCode() : 0);
|
|
||||||
result = 29 * result + (email != null ? email.hashCode() : 0);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
@ -26,6 +26,7 @@ public class AuthenticationProvider implements org.springframework.security.auth
|
|||||||
if (user == null || credentials == null || !encoder.isPasswordValid(user.getPassword(), credentials, null)) {
|
if (user == null || credentials == null || !encoder.isPasswordValid(user.getPassword(), credentials, null)) {
|
||||||
throw new BadCredentialsException("Username/Password does not match for " + auth.getPrincipal());
|
throw new BadCredentialsException("Username/Password does not match for " + auth.getPrincipal());
|
||||||
}
|
}
|
||||||
|
userDetailsService.getUserService().auditLogin(user);
|
||||||
return new UsernamePasswordAuthenticationToken(userDetails, credentials, userDetails.getAuthorities());
|
return new UsernamePasswordAuthenticationToken(userDetails, credentials, userDetails.getAuthorities());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,23 +19,27 @@
|
|||||||
package com.wisemapping.security;
|
package com.wisemapping.security;
|
||||||
|
|
||||||
import com.wisemapping.dao.UserManager;
|
import com.wisemapping.dao.UserManager;
|
||||||
|
import com.wisemapping.model.User;
|
||||||
|
import com.wisemapping.service.UserService;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.dao.DataAccessException;
|
import org.springframework.dao.DataAccessException;
|
||||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
|
|
||||||
|
|
||||||
public class UserDetailsService
|
public class UserDetailsService
|
||||||
implements org.springframework.security.core.userdetails.UserDetailsService {
|
implements org.springframework.security.core.userdetails.UserDetailsService {
|
||||||
private UserManager userManager;
|
private UserService userService;
|
||||||
private String adminUser;
|
private String adminUser;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserDetails loadUserByUsername(@NotNull String email) throws UsernameNotFoundException, DataAccessException {
|
public UserDetails loadUserByUsername(@NotNull String email) throws UsernameNotFoundException, DataAccessException {
|
||||||
final com.wisemapping.model.User model = userManager.getUserBy(email);
|
final User user = userService.getUserBy(email);
|
||||||
|
|
||||||
if (model != null) {
|
if (user != null) {
|
||||||
return new UserDetails(model, isAdmin(email));
|
return new UserDetails(user, isAdmin(email));
|
||||||
} else {
|
} else {
|
||||||
throw new UsernameNotFoundException(email);
|
throw new UsernameNotFoundException(email);
|
||||||
}
|
}
|
||||||
@ -45,12 +49,12 @@ public class UserDetailsService
|
|||||||
return email != null && adminUser != null && email.trim().endsWith(adminUser);
|
return email != null && adminUser != null && email.trim().endsWith(adminUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserManager getUserManager() {
|
public UserService getUserService() {
|
||||||
return userManager;
|
return userService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserManager(UserManager userManager) {
|
public void setUserService(UserService userManager) {
|
||||||
this.userManager = userManager;
|
this.userService = userManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAdminUser() {
|
public String getAdminUser() {
|
||||||
|
@ -40,7 +40,7 @@ public interface UserService {
|
|||||||
|
|
||||||
public void resetPassword(@NotNull String email) throws InvalidUserEmailException;
|
public void resetPassword(@NotNull String email) throws InvalidUserEmailException;
|
||||||
|
|
||||||
public User reloadUser(final User user);
|
|
||||||
|
|
||||||
public void deleteUser(@NotNull User user);
|
public void deleteUser(@NotNull User user);
|
||||||
|
|
||||||
|
public void auditLogin(@NotNull User user);
|
||||||
}
|
}
|
||||||
|
@ -20,16 +20,13 @@ 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.Mailer;
|
|
||||||
import com.wisemapping.mail.NotificationService;
|
import com.wisemapping.mail.NotificationService;
|
||||||
|
import com.wisemapping.model.AccessAuditory;
|
||||||
import com.wisemapping.model.Collaborator;
|
import com.wisemapping.model.Collaborator;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class UserServiceImpl
|
public class UserServiceImpl
|
||||||
@ -38,6 +35,7 @@ public class UserServiceImpl
|
|||||||
private MindmapService mindmapService;
|
private MindmapService mindmapService;
|
||||||
private NotificationService notificationService;
|
private NotificationService notificationService;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void activateAccount(long code)
|
public void activateAccount(long code)
|
||||||
throws InvalidActivationCodeException {
|
throws InvalidActivationCodeException {
|
||||||
final User user = userManager.getUserByActivationCode(code);
|
final User user = userManager.getUserByActivationCode(code);
|
||||||
@ -51,10 +49,7 @@ public class UserServiceImpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public User reloadUser(final User user) {
|
@Override
|
||||||
return this.getUserBy(user.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resetPassword(@NotNull String email)
|
public void resetPassword(@NotNull String email)
|
||||||
throws InvalidUserEmailException {
|
throws InvalidUserEmailException {
|
||||||
final User user = userManager.getUserBy(email);
|
final User user = userManager.getUserBy(email);
|
||||||
@ -66,8 +61,6 @@ public class UserServiceImpl
|
|||||||
|
|
||||||
// Send an email with the new temporal password ...
|
// Send an email with the new temporal password ...
|
||||||
notificationService.resetPassword(user, password);
|
notificationService.resetPassword(user, password);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidUserEmailException("The email '" + email + "' does not exists.");
|
throw new InvalidUserEmailException("The email '" + email + "' does not exists.");
|
||||||
}
|
}
|
||||||
@ -90,10 +83,19 @@ public class UserServiceImpl
|
|||||||
return lo + i;
|
return lo + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void deleteUser(@NotNull User user) {
|
public void deleteUser(@NotNull User user) {
|
||||||
userManager.deleteUser(user);
|
userManager.deleteUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void auditLogin(@NotNull User user) {
|
||||||
|
final AccessAuditory accessAuditory = new AccessAuditory();
|
||||||
|
accessAuditory.setUser(user);
|
||||||
|
accessAuditory.setLoginDate(Calendar.getInstance());
|
||||||
|
userManager.auditLogin(accessAuditory);
|
||||||
|
}
|
||||||
|
|
||||||
public User createUser(@NotNull User user, boolean emailConfirmEnabled) throws WiseMappingException {
|
public User createUser(@NotNull User user, boolean emailConfirmEnabled) throws WiseMappingException {
|
||||||
final UUID uuid = UUID.randomUUID();
|
final UUID uuid = UUID.randomUUID();
|
||||||
user.setCreationDate(Calendar.getInstance());
|
user.setCreationDate(Calendar.getInstance());
|
||||||
@ -127,23 +129,28 @@ public class UserServiceImpl
|
|||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void changePassword(@NotNull User user) {
|
public void changePassword(@NotNull User user) {
|
||||||
notificationService.passwordChanged(user);
|
notificationService.passwordChanged(user);
|
||||||
userManager.updateUser(user);
|
userManager.updateUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public User getUserBy(String email) {
|
public User getUserBy(String email) {
|
||||||
return userManager.getUserBy(email);
|
return userManager.getUserBy(email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public User getUserByUsername(String username) {
|
public User getUserByUsername(String username) {
|
||||||
return userManager.getUserByUsername(username);
|
return userManager.getUserByUsername(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public User getUserBy(long id) {
|
public User getUserBy(long id) {
|
||||||
return userManager.getUserBy(id);
|
return userManager.getUserBy(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void updateUser(@NotNull User user) {
|
public void updateUser(@NotNull User user) {
|
||||||
userManager.updateUser(user);
|
userManager.updateUser(user);
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,16 @@
|
|||||||
|
|
||||||
<hibernate-mapping>
|
<hibernate-mapping>
|
||||||
|
|
||||||
<class name="com.wisemapping.model.UserLogin" table="USER_LOGIN">
|
<class name="com.wisemapping.model.AccessAuditory" table="ACCESS_AUDITORY">
|
||||||
<id name="id">
|
<id name="id">
|
||||||
<generator class="increment"/>
|
<generator class="increment"/>
|
||||||
</id>
|
</id>
|
||||||
<property name="loginDate" column="login_Date"/>
|
<property name="loginDate" column="login_Date"/>
|
||||||
<property name="email"/>
|
<many-to-one name="user"
|
||||||
|
column="USER_ID"
|
||||||
|
not-null="true"
|
||||||
|
class="com.wisemapping.model.User"
|
||||||
|
/>
|
||||||
</class>
|
</class>
|
||||||
|
|
||||||
</hibernate-mapping>
|
</hibernate-mapping>
|
@ -28,7 +28,7 @@
|
|||||||
<value>com/wisemapping/model/MindMap.hbm.xml</value>
|
<value>com/wisemapping/model/MindMap.hbm.xml</value>
|
||||||
<value>com/wisemapping/model/Collaboration.hbm.xml</value>
|
<value>com/wisemapping/model/Collaboration.hbm.xml</value>
|
||||||
<value>com/wisemapping/model/CollaborationProperties.hbm.xml</value>
|
<value>com/wisemapping/model/CollaborationProperties.hbm.xml</value>
|
||||||
<value>com/wisemapping/model/UserLogin.hbm.xml</value>
|
<value>com/wisemapping/model/AccessAuditory.hbm.xml</value>
|
||||||
<value>com/wisemapping/model/MindMapHistory.hbm.xml</value>
|
<value>com/wisemapping/model/MindMapHistory.hbm.xml</value>
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="userDetailsService" class="com.wisemapping.security.UserDetailsService">
|
<bean id="userDetailsService" class="com.wisemapping.security.UserDetailsService">
|
||||||
<property name="userManager" ref="userManager"/>
|
<property name="userService" ref="userService"/>
|
||||||
<property name="adminUser" value="${admin.user}"/>
|
<property name="adminUser" value="${admin.user}"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
@ -53,6 +53,8 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$('#changePasswordMsg').hide();
|
$('#changePasswordMsg').hide();
|
||||||
|
$('#changeInfoMsg').hide();
|
||||||
|
|
||||||
function postChange(url, postBody, msgContainerId, successMsg) {
|
function postChange(url, postBody, msgContainerId, successMsg) {
|
||||||
// Change success message ...
|
// Change success message ...
|
||||||
jQuery.ajax(url, {
|
jQuery.ajax(url, {
|
||||||
|
@ -62,9 +62,12 @@ user_id INTEGER NOT NULL,
|
|||||||
--FOREIGN KEY(user_id) REFERENCES USER(colaborator_id)
|
--FOREIGN KEY(user_id) REFERENCES USER(colaborator_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE USER_LOGIN
|
CREATE TABLE ACCESS_AUDITORY (
|
||||||
(id INTEGER NOT NULL IDENTITY,
|
id INTEGER NOT NULL IDENTITY,
|
||||||
email varchar(255),
|
user_id INTEGER NOT NULL,
|
||||||
login_date date);
|
login_date date,
|
||||||
|
FOREIGN KEY(user_id) REFERENCES USER(id)
|
||||||
|
);
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
SHUTDOWN;
|
SHUTDOWN;
|
@ -14,7 +14,7 @@ password varchar(255) CHARACTER SET utf8 NOT NULL,
|
|||||||
activationCode BIGINT(20) NOT NULL,
|
activationCode BIGINT(20) NOT NULL,
|
||||||
activation_date date,
|
activation_date date,
|
||||||
allowSendEmail char(1) CHARACTER SET utf8 NOT NULL default 0,
|
allowSendEmail char(1) CHARACTER SET utf8 NOT NULL default 0,
|
||||||
FOREIGN KEY(colaborator_id) REFERENCES COLLABORATOR(id)
|
FOREIGN KEY(colaborator_id) REFERENCES COLLABORATOR(id) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||||
) CHARACTER SET utf8 ;
|
) CHARACTER SET utf8 ;
|
||||||
|
|
||||||
CREATE TABLE MINDMAP (
|
CREATE TABLE MINDMAP (
|
||||||
@ -28,7 +28,7 @@ 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 varchar(255) CHARACTER SET utf8 ,
|
||||||
FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id)
|
FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||||
) CHARACTER SET utf8 ;
|
) CHARACTER SET utf8 ;
|
||||||
|
|
||||||
|
|
||||||
@ -53,20 +53,22 @@ properties_id INTEGER NOT NULL,
|
|||||||
mindmap_id INTEGER NOT NULL,
|
mindmap_id INTEGER NOT NULL,
|
||||||
role_id INTEGER NOT NULL,
|
role_id INTEGER NOT NULL,
|
||||||
FOREIGN KEY(colaborator_id) REFERENCES COLLABORATOR(id),
|
FOREIGN KEY(colaborator_id) REFERENCES COLLABORATOR(id),
|
||||||
FOREIGN KEY(mindmap_id) REFERENCES MINDMAP(id)
|
FOREIGN KEY(mindmap_id) REFERENCES MINDMAP(id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||||
FOREIGN KEY(properties_id) REFERENCES COLLABORATION_PROPERTIES(id),
|
FOREIGN KEY(properties_id) REFERENCES COLLABORATION_PROPERTIES(id) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||||
) CHARACTER SET utf8 ;
|
) CHARACTER SET utf8 ;
|
||||||
|
|
||||||
CREATE TABLE TAG(
|
CREATE TABLE TAG(
|
||||||
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
name varchar(255) CHARACTER SET utf8 NOT NULL,
|
name varchar(255) CHARACTER SET utf8 NOT NULL,
|
||||||
user_id INTEGER NOT NULL,
|
user_id INTEGER NOT NULL,
|
||||||
FOREIGN KEY(user_id) REFERENCES USER(colaborator_id)
|
FOREIGN KEY(user_id) REFERENCES USER(colaborator_id) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||||
) CHARACTER SET utf8 ;
|
) CHARACTER SET utf8 ;
|
||||||
|
|
||||||
CREATE TABLE USER_LOGIN (
|
CREATE TABLE ACCESS_AUDITORY (
|
||||||
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
email varchar(255) CHARACTER SET utf8 ,
|
login_date date,
|
||||||
login_date date
|
user_id INTEGER NOT NULL,
|
||||||
|
FOREIGN KEY(user_id) REFERENCES USER(id) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||||
) CHARACTER SET utf8 ;
|
) CHARACTER SET utf8 ;
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
@ -13,7 +13,25 @@ ALTER TABLE `wisemapping`.`mindmap` DROP COLUMN `editor_properties` , DROP COLUM
|
|||||||
ALTER TABLE `wisemapping`.`mindmap` CHANGE COLUMN `owner_id` `creator_id` INT(11) NOT NULL
|
ALTER TABLE `wisemapping`.`mindmap` CHANGE COLUMN `owner_id` `creator_id` INT(11) NOT NULL
|
||||||
, DROP INDEX `owner_id`
|
, DROP INDEX `owner_id`
|
||||||
, ADD INDEX `owner_id` (`creator_id` ASC) ;
|
, ADD INDEX `owner_id` (`creator_id` ASC) ;
|
||||||
|
|
||||||
ALTER TABLE `wisemapping`.`collaboration` ADD COLUMN `properties_id` INT(11) NULL DEFAULT NULL AFTER `role_id` ;
|
ALTER TABLE `wisemapping`.`collaboration` ADD COLUMN `properties_id` INT(11) NULL DEFAULT NULL AFTER `role_id` ;
|
||||||
|
DROP TABLE USER_LOGIN;
|
||||||
|
|
||||||
|
CREATE TABLE ACCESS_AUDITORY (
|
||||||
|
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
user_id INTEGER NOT NULL,
|
||||||
|
login_date date
|
||||||
|
) CHARACTER SET utf8 ;
|
||||||
|
|
||||||
|
ALTER TABLE ACCESS_AUDITORY
|
||||||
|
ADD CONSTRAINT `user_id`
|
||||||
|
FOREIGN KEY ()
|
||||||
|
REFERENCES `wisemapping`.`USER` ()
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE NO ACTION
|
||||||
|
, ADD INDEX `user_id` () ;
|
||||||
|
|
||||||
|
|
||||||
|
# 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;
|
||||||
|
# DROP TABLE FEEDBACK;
|
||||||
|
|
||||||
#INSERT INTO `wisemapping`.`collaborator` (`id`, `email`, `creation_date`) VALUES (8081, 'fake@wisemapping.com', '2007-10-09');
|
|
||||||
|
Loading…
Reference in New Issue
Block a user