mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 14:17:57 +01:00
Check for more period.
This commit is contained in:
parent
04d58533cf
commit
a60f001f2c
@ -22,7 +22,9 @@ 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.AccessAuditory;
|
import com.wisemapping.model.AccessAuditory;
|
||||||
|
import org.hibernate.ObjectNotFoundException;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
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;
|
||||||
//import org.acegisecurity.providers.encoding.PasswordEncoder;
|
//import org.acegisecurity.providers.encoding.PasswordEncoder;
|
||||||
@ -69,8 +71,15 @@ public class UserManagerImpl
|
|||||||
return cola;
|
return cola;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public User getUserBy(long id) {
|
public User getUserBy(long id) {
|
||||||
return getHibernateTemplate().get(User.class, id);
|
User user = null;
|
||||||
|
try{
|
||||||
|
user = getHibernateTemplate().get(User.class, id);
|
||||||
|
} catch (ObjectNotFoundException e){
|
||||||
|
// Ignore ...
|
||||||
|
}
|
||||||
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -135,43 +135,35 @@ public class AdminController extends BaseController {
|
|||||||
|
|
||||||
for (int i = minUid; i < maxUid; i++) {
|
for (int i = minUid; i < maxUid; i++) {
|
||||||
System.out.println("Looking for user:" + i);
|
System.out.println("Looking for user:" + i);
|
||||||
try {
|
final User user = userService.getUserBy(i);
|
||||||
final User user = userService.getUserBy(i);
|
if (user != null) {
|
||||||
if (user != null) {
|
// Do not process admin accounts ...
|
||||||
// Do not process admin accounts ...
|
if (user.getEmail().contains("wisemapping")) {
|
||||||
if (user.getEmail().contains("wisemapping")) {
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Iterate over the list of maps ...
|
// Iterate over the list of maps ...
|
||||||
final List<Collaboration> collaborations = mindmapService.findCollaborations(user);
|
final List<Collaboration> collaborations = mindmapService.findCollaborations(user);
|
||||||
for (Collaboration collaboration : collaborations) {
|
for (Collaboration collaboration : collaborations) {
|
||||||
final Mindmap mindmap = collaboration.getMindMap();
|
final Mindmap mindmap = collaboration.getMindMap();
|
||||||
if (MindmapFilter.MY_MAPS.accept(mindmap, user)) {
|
if (MindmapFilter.MY_MAPS.accept(mindmap, user)) {
|
||||||
|
|
||||||
final Calendar yearAgo = Calendar.getInstance();
|
final Calendar yearAgo = Calendar.getInstance();
|
||||||
yearAgo.add(Calendar.MONTH, -18);
|
yearAgo.add(Calendar.MONTH, -8);
|
||||||
// The use has only two maps... When they have been modified ..
|
// The use has only two maps... When they have been modified ..
|
||||||
System.out.println("Checking map id:" + mindmap.getId());
|
System.out.println("Checking map id:" + mindmap.getId());
|
||||||
if (mindmap.getLastModificationTime().before(yearAgo) && !mindmap.isPublic()) {
|
if (mindmap.getLastModificationTime().before(yearAgo) && !mindmap.isPublic()) {
|
||||||
System.out.println("Old map. Is simple ?:" + mindmap.getId());
|
System.out.println("Old map. Is simple ?:" + mindmap.getId());
|
||||||
|
|
||||||
if (isWelcomeMap(mindmap) || isSimpleMap(mindmap)) {
|
if (isWelcomeMap(mindmap) || isSimpleMap(mindmap)) {
|
||||||
System.out.println("Purged map id:" + mindmap.getId() + ", userId:" + user.getId());
|
System.out.println("Purged map id:" + mindmap.getId() + ", userId:" + user.getId());
|
||||||
if (apply) {
|
if (apply) {
|
||||||
mindmapService.removeMindmap(mindmap, user);
|
mindmapService.removeMindmap(mindmap, user);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (WiseMappingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (RuntimeException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user