package com.javaeye.jert.interceptor;
import com.javaeye.core.Application;
import com.javaeye.jert.service.SecurityService;
import com.javaeye.user.Group;
import com.javaeye.user.UserManager;
import com.opensymphony.xwork.ActionInvocation;
import com.opensymphony.xwork.interceptor.Interceptor;
/**
* @author Quake Wang
* @since 2005-1-16
* @version $Revision: 1.2 $
*/
public class SetupDoneInterceptor implements Interceptor {
public void destroy() {
// TODO Auto-generated method stub
}
public void init() {
// TODO Auto-generated method stub
}
public String intercept(ActionInvocation invocation) throws Exception {
UserManager userManager = (UserManager) Application.getInstance().getContainer().getComponent(UserManager.class);
Group adminGroup = userManager.getGroup(SecurityService.ADMIN);
if(adminGroup != null && adminGroup.getUsers().size() > 0) {
return "setupDone";
}else{
return invocation.invoke();
}
}
}